javascript

AJAX GET race condition?

I am attempting to track events when links are clicked on my site in a method similar to the following. <a href="/example" class="track">Example</a> <script type="text/javascript"> jQuery(function($) { // track clicks on all anchor tags that require it $('a.track').live('click', function(e) { // send an ...

jquery .load() and IE

Hi there, Tested the below code with FF, Safary and Chrome and all works ok. But with IE... not so When the button "viewEditButID'" is click the div "customerDetailsDivClass" is hidden. When it's click again the div reapers but before it dose so it download the data is going to display. $(document).ready( function() { $('#viewEditButID...

Validate JS script block within an HTML file in Eclipse

Is there a way to have eclipse validate javascript within a <script> block on an HTML page? ...

Checkbox validation - at least one selected

Hi, I have number of checkboxes and another checkbox for "Select All" I want to check if the user has selected at least one checkbox. Need modification in javascript <script language="Javascript"> function doSubmit(){ function check_checkboxes() { checked=false; var c = document.getElementsByTagName('INPUT'); for (var i = 1; i < c....

What Browser-side Javascript Module Loaders are production-ready?

I'm working on a large web application with many javascript files. I'd like to turn those into CommonJs Modules to make dependencies explicit. What browser-side loaders exist for CommonJs modules, and what are their limitations? Browser targeted CommonJS loaders that I can find are Tiki and Yabble. Has anyone tried them, and how well do...

Javascript array error

Hi, I am trying to make one array equal another array like so: elementStyle[property] = styles[property]; But i keep getting a "invalid argument" error. Any Ideas???? Addtional: The code is on: http://prototypejs.org/assets/2009/8/31/prototype.js. The area that i'm interested in is: setStyle: function(element, styles) { element =...

Using jsTree XML module

I'm confused by jsTree's XML module. I'm using 1.0rc2. Specifically, jsTree converts XML to an HTML list-based tree using XSLT. I couldn't get my XML to render so checked out the source code; looks like the XSL is hard-coded into jsTree's code and one particular line means it will only work if you're root's child elements are called ...

Wrapper for default date constructor in Javascipt?

I want a kind of wrapper for the default Date object in Javascript so that whenever I have something like var a = new Date(), I want to execute some particular code in the constructor. I basically want to have my own Date class that needs to be invoked whenver a call is made to Date() rather than the native code. TIA ...

JavaScript - Get all but last item in array

This is my code: function insert(){ var loc_array = document.location.href.split('/'); var linkElement = document.getElementById("waBackButton"); var linkElementLink = document.getElementById("waBackButtonlnk"); linkElement.innerHTML=loc_array[loc_array.length-2]; linkElementLink.href = loc_array[loc_array.length]; } I wan...

need to pass variable to function

I am trying to pass a variable to a a function that I believe calls another function (I think) but am having problems. The variable I need to use in the second function is productid but several ways thAt I have tried have not worked. either a fix in javascript or Jquery will be great!!! This is the line that I need the variable for var...

jquery html() not working on positioned element in Chrome

I have a paragraphed named dialog I am trying to add content to via ajax. The element is positioned like so: <div id="modal" style="height:100%; width:100%; position:fixed; z-index:1; left:0; top:0; display:none;"> <div style="position:fixed; top:50%; left:0; width:100%;"> <div style="height:150px; width:300px; margin:auto;"> ...

How to check the number of open connections in node.js?

Hello there! I have a machine running node.js (v0.1.32) with a tcp server (tcp.createServer) and a http server (http.createServer). The http server is hit by long polling requests (lasting 50 sec each) from a comet based application on port 80. And there are tcp socket connections on port 8080 from an iphone application for the same pur...

fireevent for mouse events in IE gets fired at different clientPoint

Hi, I am trying to fire a mouse event in IE at a particular coordinate. All the coordinates are set right before firing the event. But when the event gets fired, the client point gets changed and gets the value same as offset point. i.e., I created a mouse event with ClientPoint = (583,438) , offset= (585,481) and screen = (585,589). Th...

iOS 4 UIWebView Trouble with Javascript...

I have code that works great in 3.2 and earlier. The javascript from my UIWebView Load - never seems to execute... Any idea what changed with 4.0 that might cause a problem...? my current code has a bunch of javascript in the page to load and format - one of the things is a variable that indicates the javascript prep is done... I am ch...

Is there a better (more efficient) way to run an href?

Hi all, I was wondering if there's a better way to execute a link's href attribute other than evaling it? For example: eval($("a[href^=javascript:]").attr("href").replace(/^javascript:/,"")); // better (more eficient) way to do this? Thanks!! ...

How not to pass cookies in an ExtJS HTTPRequest

Hi, I have an application using ExtJS on the front end and TurboGears on the server. I am now started to add cookies to handle customisation front side using the CookieProvider state manager. This is cool but the cookies are passed on every call and these cookies are sizable. I have concerns about the performance hit. Long and short, is...

Dojo vs YUI javascript framework

I want to know what you guys think of these 2 frameworks, in terms of: robustness, code quality, core developers moving forward with new features, cross browser problems, module components, easiest to learn and integrate I already know and use jQuery, I recently found it lacking in terms of 'enterprise ready' components for large w...

JavaScript .replace only replaces first Match

var textTitle = "this is a test" var result = textTitle.replace(' ', '%20'); But the replace functions stops at the first instance of the " " and I get the Result : "this%20is a test" Any ideas on where Im going wrong im sure its a simple fix. ...

Javascript - Replace '%20' spaces

var loc_array = document.location.href.split('/'); var linkElement = document.getElementById("waBackButton"); var newT = document.createTextNode(loc_array[loc_array.length-2]); var repl = newT.replace('%20',' '); linkElement.appendChild(repl); Anyone know why this causes the text to not show up? ...

Differentiating between arrays and "hashes" in Javascript.

In order to make the syntax for one of my functions nicer, I need to be able to tell whether a specific parameter is an array or "hash" (which I know are just objects). Typeof doesn't work, because they both return the same thing typeof {foo:"bar"} // Object typeof ["foo","bar"] // Object So how would I differentiate between the two?...