javascript

asp.net mvc json open dialog box problem

function postForm() { $.ajax({ type: "POST", data: $("#myForm").serialize(), dataType: "json", url: '<%= Url.Action("JSONRequest","Home") %>', success: function(result) { window.alert(result.name); }, error : function() { window...

Javascript - telling setInterval to only fire x amount of times?

Is it possible to limit the amount of times that setInterval will fire in javascript? ...

Rendering html/js in J2me app?

Is is possible to display html document in J2ME mobile app? Is it possible using for example WebKit? I was looking for some webkit's j2me implementation or some tutorial or advice in google but found nothing. ...

Get Flickr Sets

Hi everyone. Usual stuff, Googled forever, looked on here, no help. Yet. What I want is to list the sets of photos I have on Flickr. Nice & simple, it would seem. I want the 'title image' (the one used as the thumb for it on Flickr its self), the title and URL. Can't be that hard, can it? The language of choice is PHP (5.1.6), or JS (...

For "draggable" div tags that are NOT nested: JQuery/JavaScript div tag “containment” approach/algorithm?

Background: I've created an online circuit design application where .draggable() div tags are containers that contain smaller div containers and so forth. Question: For any particular div tag I need to quickly identify if it contains other div tags (that may in turn contain other div tags). --> Since the div tags are draggable, in the ...

How to send attributes via onmouseup?

I'm ajaxing my content and can't figure out why i can't pass a variable to my function event: ..somewhere inside the each loop var file = 'something'; html+='<li><a href="" onclick="return false;" onmouseup="preview('+file+');" style="background: url('link') no-repeat;"></a></li>'; } function preview(file) ... alert(file); ...

JQuery Animate.

Hi Really easy, I'm sure... I have a div which is the full screen and I want it to slide down from the top to the bottom. I have this: $('#full-screen').animate({ "bottom":0, height: 'toggle' }, 1000, function() { // Animation complete. }); But this is the wrong way round as the bottom moves up; how do I get the bottom...

How to Extract URL from the Text with javascript

Eg: Google site http://www.google.com output: http://www.google.com Eg: Yahoo site www.yahoo.com output: www.yahoo.com ...

jQuery attr command

I want to add a value to the onchange event, but the JS code has errors $(args).attr('onChange', 'setTimeout('__doPostBack(\'ctl00$cpBody$txtDate\',\'\')', 0)'); anyone see error? ...

jQuery Address double load on init

Hi All! I'm using jQuery Address to load in my content, but it's doing it twice on the init. I set it up so that if you go to the main category it loads the first image, but it's doing it twice and I'm not sure how to stop it. A fresh pair of eyes would be appreciated! $.address.init(function(event) { $('#carousel-clip a').address...

Vertical scrollbars with window.open

I am opening a popop windows with window.open. I want the scrollbars to show up if needed. However in safari, the scrollbars are not showing up unless I set, scrollbars=1, However that makes even horizontal scrollbars show up. Is there a way to specify, "Show only horizontal scrollbars, if needed" to popop window. (Possibly via some c...

The best way to write a jQuery plugin - If there is such a way?

There are quite a few ways to write plugins i.e. here's a nice example and what I've seen quite a lot of lately is the following code pattern and it's used by Doug Neiner here; (function($){ $.formatLink = function(el, options){ var base = this; base.$el = $(el); base.el = el; base.$el.data("formatLink", base); ba...

Replacement of text using JavaScript

i want to replace some selected character from my text-area with some string. To do this i wrote the following JavaScript code var old_tag = "["; var tag= " <xsl:value-of select = "; var endtag= " />"; var txt=''; if(document.selection) { txt = document.selection.createRange().text document.selection.creat...

Need a regular expression for an Irish phone number

I need to validate an Irish phone number but I don't want to make it too user unfriendly, many people are used to writing there phone number with brackets wrapping their area code followed by 5 to 7 digits for their number, some add spaces between the area code or mobile operator. The format of Irish landline numbers is an area code of ...

finding specific immediate children of an element using prototype

Following DOM structure: <ul> <li class="item">yes</li> <li>no</li> <li class="item">yes</li> <li> <ul> <li class="item">no</li> </ul> </li> </ul> Assuming I have the outer <ul> in $ul. How do I get the two immediate children which have the item-class? In jQuery I would write something like this: $ul.children...

BlockUI jquery plugin keeps page blocked after "back" button. Opera/FireFox

I use jquery blockUI plugin (v2) and call $.blockUI when user submits a form. Web page smoothly fades out and new page appears. That's ok. But when user presses "back" button in opera/fire fox he observes fade out page with hourglass mouse cursor that is completely blocked. Chrome/IE visualize page ok. What would you suggest? Thank y...

perl captcha doesn't refresh on windows 7

I have created a captcha which looks like this: <img src="/cgi-bin/rand.pl" /> The problem is that if someone navigates away from or back to the page with the captcha on it, it doesn't refresh which makes the captcha invalid (especially if they have already submitted the form before) Is there anyway to force a refresh as I suspect set...

Documentation generator tool for BOTH Javascript and PHP

Do you know about a tool to easily create documentation for both Javascript and PHP code? Something that takes comments in code similar to the one shown below: /********************************************************** This fucntion does something special... param1: ... param2: RETURNED VALUES: ... **********************************...

ASP.NET MVC routing and paths is js files

Hello, we're facing a problem now. We have a pretty big page with a loooong inline script, which does all the work. We now want to obfuscate it and use it as a separate .js file. But the problem is that we have paths which are generated by Url helper (Url.Content()). So what is the best way to separate js file from the page and not using...

Facebook's new Javascript SDK stream.publish broken?

Using FB.ui({ method: 'stream.publish' ...}) It fails to accept my attachment media complaining it should be an array (while it is). The old API (FB.Connect.streamPublish) accepted the format just fine, and all the other options seem to be valid. I find the Facebook documentation to be a mess, somebody got this working with the new vers...