javascript

Adding two floats and assigning the total to a input field

Hi guys, as the title states, I am trying to add two floats using javascript/jquery, and then assign the value to another input field, but sometimes when I add the two I get something like 1234.567800000000, any idea on how I can fix this? EDIT: I would like something like this, 1234.56 here is my code, jQuery: $("[data-custom*='mi...

Thickbox windows showing up twice

When I am clicking on href for the first time thickbox is coming properly but when I am closing it and reopening it there are two windows first window with title which is working fine and other window with no content and the close button on the title is also not working. Any help will be appreciated. Thanks in advance. ...

Ignoring whitespace in Javascript regular expression patterns?

From my research it looks like Javascript's regular expressions don't have any built-in equivalent to Perl's /x modifier, or .NET's RegexOptions.IgnorePatternWhitespace modifier. These are very useful as they can make a complex regex much easier to read. Firstly, have I missed something and is there a Javascript built-in equivalent to ...

Undefined variable in array in prototype

Hi, I have the following code: <ul id="litemsd"> <li class="litemd"> <input type="checkbox" id="d1" name="d1" /> <label for="d1">Number One</label> </li> <li class="litemd"> <input type="checkbox" id="d2" name="d2" /> <label for="d2">Numer Two</label> </li> <li class="litemd"> <input type="checkbox" id="d3" name="d3" /> ...

JavaScript clearTimeout issue on Chrome

I have a timer going on my page at an interval of 10s. It is created using setTimeout("myWork()", 10000). It works perfectly. At some point in time based on some conditions, I clear this interval and create a new one that has to tick at 1s interval. var tenSecTimer = 0; if (myCondition) { clearTimeout(tenSecTimer); tenSecTimer = se...

Object.defineProperty in ES5?

I'm seeing posts about a 'new' Object.create that makes enumeration configurable. However, it relies on a Object.defineProperty method. I can't find a cross browser implementation for this method. Are we stuck writing for the old Object.create? I can't write things that won't work in IE6/7. ...

parsing json response

I'm calling a REST webservice and getting JSON format as a result. I'm calling rest service from another domain than mine. How can I parse this? ...

Javascript checkbox selection order

How would I go about detecting the order in which checkboxes are checked? I have a list of checkboxes on a form, and I need to have users select their first and second choices (but no more). So, given this: <input name="checkbox1" type="checkbox" value="a1"> Option 1 <input name="checkbox1" type="checkbox" value="a2"> Option 2 <input ...

XML Javascript parse problem (specific code question )

Hi, I'm using the following parser to parse xml function parseXML(text) { var doc; if(window.DOMParser) { var parser = new DOMParser(); doc = parser.parseFromString(text, "text/xml"); } else if(window.ActiveXObject) { doc = new ActiveXObject("Microsoft.XMLDOM"); doc.async = "false"; ...

JSP not detecting the javascript file

From a servlet, I'm forwarding the request to a JSP page which renders a FusionChart. But I've a problem in loading the chart. The JSP file is not detecting the JavaScript file. The folder structure is: axis | WebContent | WEB-INF | classes |_ com |_FusionCharts.js |_MyChartJsp.jsp...

what is jquery and xquery

what is the best place to learn these ...

Is there a good physics engine for web browsers?

I am using JavaScript with images, SVG, canvas or pure HTML and CSS. ...

How to redirect main window to URL from popup?

I have a pop-up window with a form in it. On submit of the form, I wish to redirect to a particular page, but on the parent window (not on the popup). How can I achieve this using Javascript? After Application of Josh Idea I am calling a javascript function to submit a form, in this javascript, below is the mentioned code So Can thi...

Javascript Associative Array

I have an autocomplete text box that users can type an item code into and need to find out what the id number of that item code is in javascript. An associative array is the way I would imagine it should be done, but the following seems a little long winded and Im hoping someone has a better way to do it or shorthand of what I have belo...

IE and Selenium: window.createPopup()

Hi! I've been playing with Selenium lately, trying to create tests for an IE only application. Things were progressing (though slowly as without the recorder plugin I had to resort to trial and error to try to find the appropriate element paths), but now I'm stuck with a problem related to popup menues. Most of the application actions...

Display a "Yes / No" alert box in C# code behind

I am trying to display a "Yes / No" messagebox from codebehind in C#. I want to call an "AddRecord" procedure if the user clicks "Yes", and do nothing if the user clicks "No". Ideally, I want to use the code below, but from codebehind: OnClientClick = "return confirm('Are you sure you want to delete?');" I search on SO and google,...

How to add Return Home button to external sites?

Hi, I am developing a website with some links to some pages on external websites (belonging to the same company). The client wants to add a way to easily return to the home site, i.e. something better than just using the browser's Back button, and something better than just opening the external links in a new browser window. Seeing as ...

Adding an input box and button into an existing page with javascript bookmarklet

Is it possible to have a javascript bookmarklet to add in a new input box into an existing page? Basically I need to have a prompt box to save a variable but I don't want it to pop up, I want it just in the page so I can then have it filled out and submit so the variable can be used in another piece of javascript. Its kind of confusing...

if there is already an 'onchange' event on a dropdown, if I bind another, when will it fire?

There is an 'onchange' event, using inline javascript on a dropdown list which I have no control over. In the onready event, if I bind another onchange event, which one will fire first? And will this be a gauranteed order? I want mine to fire AFTER the inline js onchange event. ...

$('#id1').html(" ") removes all children of #id1 from DOM, or they are still there ?

I do something like this: $("#id1").html(data); I refill a div with html but when I try to get the html of a child of this refilled div I get an empty string although it has, it's like the old child is still there but without html. Edit: I tried to reproduce my problem, here is the html: (click 2x times on refill and after click open...