javascript

Do Applet JSObject javascript calls serialize?

Do applet javascript calls serialize in any proper way? I'm considering implementing a model in which two threads send off javascript commands. One responds to requests from the browser (js), and the other hits the browser periodically. My question is this: what happens if these two javascript requests collide? I'm worried about concurr...

Waiting for javascript async callback @ http post

Hi guys, I'm implementing a small feature and kind of stuck. I have a button to execute some action, such as <input type="submit" value="My Button" onclick="javascript:DoSomething();" /> When the user clicks the button the function DoSomething is called. function DoSomething() { var geocoder = new GClientGeocoder();...

tabIndex Attribute and AJAX

I've seen some posts about tabIndex issues, but I was unable to find one like the scenario below that I need to fix. So here's the lowdown on the project. It's an ASP.NET 2.0 web app using AJAX 1.0 Extensions and jQuery. I'm looking for any ideas from any programming language to handle a scenario like this. So first off, I know how to...

Toggling link text when navigating between pages based on selected stylesheet

Hello, I have installed a script on my website that allows for a low contrast setting and a high contrast setting, as my site will be used by sight impaired persons. The script works perfectly. The only problem is when a visitor visits multiple pages of the site. When you first visit the site, the low contrast setting is in effect by d...

On an ASP.NET link button, Is it possible to move the JavaScript function call from the "href" attribute to the onclick event?

I would like to be able to change the default behaviour of an ASP.NET link button so that the JavaScript postback call happens in the onclick event rather than having it as the href attribute. This would mean that a user hovering over the button would not see the JavaScript in the browsers status bar. Is this possible or should I attem...

Using JSDoc with namespaces and a variant form of function definition

I've been trying to use JsDoc for documenting my javascript but I keep coming across this hurdle. It keeps saying "nothing to document, exiting" Here is the peice of code I'm trying to document: /** * Container for all editing methods * @namespace */ var FREdit = { /** * Toggle value for editing * @type Number */...

javascript REST client - issue with window.resize event

Hi, I'm building a web javascript frontend to a Geo Mapping REST api. The backend recently changed from using DWR to REST to avoid cross-domain issues with browsers. The issue is that in both IE6 and IE7 the resize event is not triggered anymore if there is a REST call made while the application loads. If the server calls made during ...

Elements positioned relatively don't move when the DOM is updated (IE6 and IE7)

I have a form with a few fieldsets. One fieldset has a table of time preferences set by the user. The user can add and delete time preferences. When they add a row, a table row is dynamically inserted into the DOM using a jQuery append(). The issue is that in IE6 and IE7 any relatively positioned elements on the page do not "bump" do...

Is there a way to use both relative and absolute year ranges on the jQuery Datepicker?

For the datepicker control in jQuery UI, is there a way to mix absolute ranges with a relative range? For example, how would you express, I want the year to only go back to 2005, but only show up to the current year? I've tried mixing the two, using something like '2005:+0', but this results in no years being available in the menu. Ye...

jQuery empty selector (null selector)

Sometimes it is useful to have an empty jQuery object, to be used either as a default value or as an initial value, when constructing a collection of items. For an example, see here. One way to do it would be to use a selector which is unlikely to match anything, like $('skdhjfksjdhfksjhdf'), but this is obviously inelegant. How can I...

Applet not seeing javascript methods every time.

I have an applet that does extensive communication with javascript and the browser. Now, I've stuck a JSObject call in the init method of the applet to notify the browser that the applet is there and good to go, but I've noticed something strange. Occasionally, when making a javascript call from an applet in its init() method, the call f...

What is jQuery's equivalent to Prototype's Ajax.Responders.register?

Is there a jQuery equivalent to this prototype code? Ajax.Responders.register({ onException: function(x,y) { if(y.message!="Syntax error") new Insertion.After("toperrorbox","<p style='color:red'>"+y.message+"</p>"); } }); ...

integer rounding with parseInt in javascript

I have the following javascript code. if( frequencyValue <= 30) leftVal = 1; else if (frequencyValue > 270) leftVal= 10; else leftVal = parseInt(frequencyValue/30); Currently if given the value 55 (for example) it will return 1 since 1< 55/30 < 2. I was wondering if there was a way...

jQuery: select the first five rows of a table

How can I quickly get a jQuery selector for the textboxes in the the first 5 rows of a table? I have a table with many rows and many textboxes; I'm just trying to select the textboxes in the first 5 rows of the table. Is there an easy way to do this? ...

Jquery toggleClass issue

initially hovering works and the "over" class is added on mouseenter and removed on mouseout, but after doing some hovering over paragraphs with class="risk" the toggle class becomes stuck, and mouseover removes it instead of adding the class (opposite of expected functionality) //changes risk map point color when hovering over // r...

Overwrite .data() if a condition is met.

I am doing a image Tool tip (larger preview), it ads a .data() of the replaced source. but on .error i want the same data to have a different value. It seems like that doesn't overwrite the .data("lrgSrc") on .error $ImgTipCanid.each(function() { var t = $(this).attr("src"); var tt = t.replace(/medium/,"Large"); var ttt = t.re...

Comet JavaScript libraries that support multiple windows

Are there any free Comet JavaScript libraries that allow multiple windows/tabs to reuse the same connection? In other words, when you open a second window, it detects that you have another window open under the same domain. Rather than open a new connection, it starts listening to the other window's connection. That way it can stay withi...

jQuery.ajax - submit all elements in form without manually entering them

Hi. I would like to use jQuery.ajax to submit a form using POST without having to specify everything manually in the "data: " part. This is what I don't want: data: "username=" + document.getElementById("username").value + "&email=" + document.getElementById("email").value, Is there a way to just have it include alla element...

jQuery pitfalls to avoid

I am starting a project with jQuery. What pitfalls/errors/misconceptions/abuses/misuses did you have in your jQuery project? ...

jQuery getJSON - Return value to the caller function

String.prototype.getLanguage = function() { $.getJSON('http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&amp;q=' + this + '&callback=?', function(json) { return json.responseData.language; }); }; How can I return the value to the caller value? Thanks. EDIT: I've tried...