javascript

I want to use the same image more than once and I would like the web browser to download this image only once, how to do it?

I want to use the same image more than once and I would like the web browser to download this image only once, how to do it? ...

Adding names to an array and outputting them to a table.

I'm having some trouble getting my code to work. This is what I have so far. function outputNamesAndTotal() { var name; var outputTable; var inputForm; var nameArray; var outputDiv; outputDiv = document.getElementById("outputDiv"); inputForm = document.getElementById("inputForm"); outputTable = document.getElementById("...

Adding Randomly choosen class to html tag using jQuery

Hello Gurus! Whet I need to do is in my menu I would like to add one of the classes (listed below) with completely random order every time when function starts (page load) This is my HTML <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About Us</a></li> <li><a href="#">Portfolio</a></li> ...

Should I do money calculations in Javascript or as an AJAX call?

Hi, I'm building a webapp using JQuery, Stripes, Spring and JPA (Hibernate). I have a page that allows users to enter a number of order line items and each time onblur occurs in the price field, I have a JQuery event bound to the field which sums all the price fields (this is a subtotal), calculates 10% tax and adds the tax to the subt...

How to assert that a jQuery cluetip has been binded to something?

Hi all: In my code, there is a cluetip that binds itself to an anchor. I need to know what sort of properties can I assert when unit testing it? At the moment, all I could do is to assert the id of the cluetip, which seems insufficient. I want to find out whether there is some sort of class in cluetip that changes when it is binded t...

Is it possible to integrate JQuery into the browser Just as javascript?

I would really like to deploy my project using jquery but afraid it may annoy the dail up users. So is it possible to integrate JQuery within the browser itself? ...

Replace text (change case) in a textbox using Javascript

I am trying to build a sort of intelli-sense text input box, where as the user types, the 'and' is replaced by 'AND \n' (i.e. on each 'and', the 'and' is capitalized and user goes to new line). The Javascript I used for this is: function Validate() { document.getElementById("search").value = document.getElementById("search").value.r...

Make NSXMLParser skip an Element

Hi, I'm using NSXMLParser on an iPhone App to parse HTML Files for a RSS or Atom Feed Link. Everything works fine until the parser find a <script> element that includes Javascript code without the CDATA Declaration, this causes a Parse Error. Is possible to tell the parser to skip all the elements named <script>? ...

TinyMCE: Detecting onLeave()

I am trying to detect when the user has left the tinyMCE editor window but I am unable to do so. Here is the code that i think should work (but isnt): $('.mceEditor').blur(function(){ // I would expect this to fire when the user leaves the // tinyMCE editor, but it never seems to fire }); I've also tried: $('*') .not('.mc...

Unescape HTML entities in Javascript?

I have some Javascript code that communicates with an XML-RPC backend. The XML-RPC returns strings of the form: <img src='myimage.jpg'> However, when I use the Javascript to insert the strings into HTML, they render literally. I don't see an image, I literally see the string: <img src='myimage.jpg'> My guess is that the HTML is bei...

showing progress with native jquery ajax functions

the problem is whenever I use $.get, $.post or $.ajax, I can't find a way to trigger a callback when the server is processing something. I can do it with the ajaxform plugin via the beforeSubmit method, but with the formerly mentioned functions, I can't find a way to do it. $.ajax has a beforeSend method, but according to the documentati...

Need help with a JavaScript regex

I am allowing to make a new field in one of my web apps, to add a product. Pushing add a product clones one of the inputs, and I set it to a blank value. I need to update the name however. The name is in this format <input type="text" name="product[0][0][3][title]" value="my product" id="input-AbGHtQS3" maxlength="150" /> I need to ...

JavaScript minifier that strips out unused code

Does anyone know of a JavaScript minifer that can detect unused code and strip it out. Google Closure seems alright but it appears to only compact. I'm looking for something much more advanced, where it can look through my JavaScript and not only compact but also remove unused code. Anyone know of such a tool? The use base being, I u...

SEVERE warning from JsTestDriver when running too many tests

Hi all: Just wondering whether there are people out there using JsTestDriverCoverage (a javascript code coverage tool used alongside with JsTestDriver) to calculate javascript code coverage? I'm getting a SEVERE panic error from the captured browser every time I ran a lot of tests with it, and am still looking for ways to get around thi...

jquery ajax events with classes

I have this code: $('.be-delete').live('click', function(e){ e.preventDefault(); var object =$(this); var url = $(this).attr('href'); $.ajax({ url : url, error : function(){alert('An error has occurred, no updates were made')}, success : function(){ object.parent().fadeOut('slow', func...

How can i close all the IE browser windows that I opened in JavaScript

How can i close all the IE browser window in asp.net, I am opening many windows..from javascript by window.open()... I need to close all the windows by clicking the button in main page(parent window). some times we have open in in c# it self btnShow.Attributes.Add("onclick", @"var windowVar=window.open('" + sAppPath + @"', 'parent');w...

read characters and words in HTML text using javascript

consider that i am getting a HTML format string and want to read the number of words & characters, Consider, i am getting, var HTML = '<p>BODY&nbsp;Article By Archie(Used By Story Tool)</p>'; now i want to get number of words and characters above html will look like: BODY Article By Archie(Used By Story Tool) IMPORTANT i want...

How to center a div generated dynamically?

Hello There, I generate a div for my javascript automated validation script. It is generated with below code: var alertbox = document.createElement("div"); Now how do i center that div programatically both horizontally and vertically? Note: Currently I am showing an alert box but once i know how to center a div, i will replace the a...

Problems opening/closing a 'popped-up' window

Hello everyone. I have a web app that launches from an online portal into a new browser window. Everything works out fine until I try to open a new window or close the window from the webapp. Everything works fine when I test it locally though. From what I've understood so far, after some Googling, it seems that this is because you can'...

Is it possible to apply MVC pattern to javascript?

Hi, Is it possible to apply MVC pattern to javascript? ...