javascript

remove or blur item from webpage

I have a site where if someone clicks on a particular item (image or swf) everything else on the page would either disappear or blur out. So the only thing left on the page that is visible is the thing that I just clicked. Is this possible to say everything change except this one div? ...

Have jquery ajax (php) scripts run one after another instead of at the same time

Here's the code - this runs as soon as the document is loaded (inside $(document).ready(function(){ ) Is there a way to code this so that the next ajax query will run after the current one is finished? I want to create more ajax calls on the page, but they will not execute until all the queued calls are completed. If each call would ru...

Return a value from an ajax call to parent function

I have a function where I need to return a url that I am getting via an ajax call. var heatmap = new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { var tileURL; $.get('getimage.php', { zoom: zoom, x: coord.x, y: coord.y }, function(data) { if(data.status) { tileURL=data.image; } },...

Find DOM in content panel asp.net

Please Help! How i can find DOM element : <asp:Content .....> .... <asp:TextBox ID="txt1" runat ="server" Text="Test"></asp:TextBox> .... </asp:Content> From PopUp window i will change atribute Text, But in JScode like ... DOM = document.getelementByID("txt1") is null. ...

Literals and Objects - When to use what?

I wonder when to use literals and when to use objects to create data type values. Eg. When do I use these: /regexp/ "string" and when these: new RegExp("regexp") new String("string") Will these give me the same methods and properties? ...

IE9: radio button selection fails with Infopath forms

After upgrading to IE9, InfoPath forms consistently fail on radio button selection. This occurrs even when using compatibility mode. ...

Why doesn't this method work to assign characters, in JavaScript?

Ok, here goes a newbie question: //function removes characters and spaces that are not numeric. // time = "2010/09/20 16:37:32.37" function unformatTime(time) { var temp = "xxxxxxxxxxxxxxxx"; temp[0] = time[0]; temp[1] = time[1]; temp[2] = time[2]; temp[3] = time[3]; temp[4] = time[5]; temp[5] = ...

LiveValidation .remove not working

I've got a Webform working with the LiveValidation extension. I have a conditional rule that if the user selects United States, then the State-or-province field must be within the list of state abbreviations. My problem is that if the user selects United States and then goes back and changes their answer the validation rule should be re...

javascript scope question

I've written a little Ajax-y page, that displays data rows from an ajax request. Each row has a "delete link" to allow the user to delete the row quickly, also via ajax. My problem is one with the scope of the function-- The "main" page has a function that looks like this: <script language="javascript" type="text/javascript"> window.a...

Calling a javacript function through micro template

Hi, I am using the micro template (Micro Template) in my project. Below is the sample <script type="text/html" id="user_tmpl"> <% for ( var i = 0; i < users.length; i++ ) { %> <li><a href="<%=users[i].url%>"><%=users[i].name%></a></li> <% } %> </script> Is it possible to call a javascript function say a simple function like t...

I am trying to create a substr method with a pointer.... is there a more elegant solution?

Here's the deal. I am doing some string manipulation and I am using the substr method often. However, the way I need to use it, is more like a php fread method. Whereas, my substr needs to be guided by a pointer. The process needs to act like this: var string='Loremipsumdolorsitamet,consectetur' and if I read in, 'Lorem'.....as my fir...

Javascript AOP support

It is easy enough (for 90% of aop features) to do it without any support being the language itself, like in most dynamic languages like python and ruby. However, Dojo had direct support for it on 1.3.2. What happened in the latest versions? Did they remove it? Is there another javascript aop library that should get more attention? ...

String object versus literal - modifying the prototype?

Hi All, I'm wondering why it seems that adding a method to the prototype of a string literal seems to work, but adding a property does not? I was playing with ideas in relation to this question, and have the following code: String.prototype._str_index1 = 0; String.prototype._str_reset = function() { this._str_index1 = 0; }; String....

CKEditor.insertHtml changing contents of div from whatever into an img

var content = window.frames[i].document.getElementById("embed").value; /* content is: '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/mmYVsGa-uZ0?fs=1&amp;amp;hl=en_US"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embe...

How do I remove trailing white spaces but not white spaces within a string (nor at the beginning)?

I have a string of varying length and is usually followed by white spaces (of varying length based on he string). i.e. - the string is always 20 characters long var data = "DUR IT R4356 " //with 8 trailing or the string could be var data = "11& 444 DTF# 5676 " //with 3 trailing What is the best way to get rid of those tra...

Executing JS in dynamically loaded content

Hi All,   I've started working on a project that loads all of the different pages content dynamically. On the surface this seems simple enough, an AJAX call to a script that returns the content that is placed inside a DIV. Except that not only HTML but JS is returned as well. I'm seeing a lot of things like this:- <img src="spacer.gif"...

What is the "acceptable" upper limit for JavaScript array size?

I left this question as generic as possible, but I do have a specific problem that I need to solve in my application and the answer to this would help. The application I am working on uses PHP/MySQL as its backend, and is set up so that no text/words/phrases visible to the user are hardcoded in the HTML/JS that is output to the browser,...

Jquery - bind/unbind hover script, small bit of code, not sure what to do.

I've created DIV.cb-toggle, when the user hovers over this div, it animates to Orange, when they hover off of this div, it animates back to gray, when the user clicks this div, it animates to blue, telling the user that it's been selected. So when it's NOT selected, it has mouseenter mouseleave animations, but when it's selected i want t...

jquery value substitution

Is this a ligitimate way of determining the selected value of an section/option box with and id of "shirt_size_1221"? var user_id = '1221'; x = "#shirt_size_" + user_id ; alert($(x + " option:selected")); ...

Best way to insert hundreds of DOM elements into the page dynamically while keeping performance high

I have a web app where we would be inserting hundreds of elements into the DOM Essentially, I'm doing $('#some_element').html('<lots of html here>'); repeatedly. In some cases I might need to do $('#some_element').appendTo('more html'); From previous experience inserting html text using the append or setting the innerHTML of an ...