javascript

Using jQuery, how do I change the elements html value? (div)

Hi, Using a ajax request I want to change content of my div. <div id="d1">202</div> So I want to change the content to a different number. $('d1').InnerText??? Also, say I wanted to increment the number, how could I do that? Do I have to convert to int? ...

Should I use semi-colons in javascript?

I've only written a small amount of javascript, that runs embedded in a java application, but tested using QUnit, has been mixed and I've not noticed any problems yet. Is there some conventional wisdom whether to use semi-colons or not in javascript? Duplicate of Do you recommend using semicolons after every statement in JavaScript? ...

getting the value of a form field after keypress event

Hello, myInput.value is one keystroke behind when I examine it in a keyPress event handler. So if the users types "a", myInput.value gives me "". Then when the user types "b", myInput.value gives me "a", and so it. The value doesn't seem to get updated with the character input by the keystroke that triggered the event. What am I doing wr...

Can I prevent window.onbeforeunload from being called when doing an AJAX call

I have an AJAX-based grid control. We hook into the window.onbeforeunload event to check if they have unsaved data and if so present them with a message "Are you sure you want to navigate away...you have unsaved data...". All this is good. But AJAX calls also trigger window.onbeforeunload and so if the grid has unsaved data and we ma...

Javascript error re connectWith variable on sortable list (jquery)

Have tried everything to get this working. Basically within each portlet there are 2 sections and users should be able to drag items from one section to the other (within the same portlet). As the sortables are generated dynamically, have tried to do something similar by creating a variable for connectWith, but keep getting javascript er...

Simple javascript and image for help text on webpage

I really want to put a little question mark image next to some of the input fields on my for so the user can click and get a little box to come up and provide some help text. A tooltip might work for this too. Here is what I would like: Script for having a little text area pop up when user clicks on an image (not a new window, just a...

JQuery event.target error

Hi, I've a box from divs (price_item) with several child divs (date, price etc.). I'm using it as a caroussel for showing prices. If one clicks on any child, the parent's background color must be changed to red. I wrote it like: $(...selectquery...).click(function() { var $tgt = $(event.target); $tgt.parent().css("backgroundColo...

Global console object in Safari/Chrome being reset.

I'm working on a jQuery plugin and am trying to make a uniform, cross-browser console object for debugging. The plugin will utilize Firebug or FirebugLite but also allows the user to choose the browser's native console object, if available. For Safari/Chrome, the console methods accept only 1 argument, while the Firebug console API (whic...

How to generate minified javascript with Script#?

I am testing Script# and its manual tells me that it has a "Release" mode, where the code is minified for performance. But I couldn't find how to enter this mode. Anyone knows? Update BenS has found a command line solution. I wonder if there is a graphical solution, preferably integrated with Visual Studio. ...

Internet Explorer 6 aborts page request when javascript executes

The scenario is this. A web page contains: some DIVs whose visibility can be toggled with a javascript (fired from an hyperlink) a Submit button, whose response takes about 5 seconds The hyperlink code is <a href="javascript:void null;" onclick="MyFunction()">foo</a> The User: Presses Submit. While he is waiting for the respons...

Where should I define my Javascript closure?

I'm creating my own JavaScript Array-like object and I have methods that call closures. I was just wondering where was the most efficient place to define a closure. For example, imagine I have a map function and a chop function: MyObject.prototype = { map: function(fn) { ... applies fn to each element ... }; chop: function() ...

Javascript reserved words?

I have some JS code which generates the following object, return { "type": "some thing", "width": 2, "colour": "#AA12BB", "values": [2,3,4] } The creation of this isn't a problem. In writing the test for the method that returns this am having a problem accessing the width/type attributes: the following assertions fail (it leads...

How to tell if a <script> tag failed to load

I'm dynamically adding <script> tags to a page's <head>, and I'd like to be able to tell whether the loading failed in some way -- a 404, a script error in the loaded script, whatever. In Firefox, this works: var script_tag = document.createElement('script'); script_tag.setAttribute('type', 'text/javascript'); script_tag.setAttribute('...

How to keep your table from "flexing" in IE6/7

I have some tabular data with some functionality to "view details" that fires off an ajax call to append a few new elements to the DOM (usually I insert another TR just after the selected row and innerHTML or append inside a TD with a colspan. My question is this, in IE6/7 my columns flex. Currently I don't have a "static" width per co...

Playing a sound notification using Google Web Toolkit

Is it possible to play a sound notification using Google Web Toolkit which will be translated to Javascript? Thanks. ...

Parameters passed to cometd.subscribe()

Hopefully this isn't too specific/small a question, but I was wondering if anyone knew what the possible arguments are for the dojo cometd subscribe() function? The few examples I've seen indicate two parameters cometd.subscribe(channel, call_back); but a few implementations I've seen include a boolean and a possible object to the pa...

How would I get a Hash value of a users file with Javascript or Flash?

What I need to do is provide a file browser box on a web page where a user selects a file from their computer and, through javascript (or flash if necessary), some sort of Hash is returned such as CRC, MD5 or SHA1. I would prefer not to have to upload the entire file to the web server, as I expect some rather large files to be used in th...

Javascript Pop Up Page Makes Text Invisible In Internet Explorer

I'm working on a project at the moment where I've come up against a rather frustrating problem in Internet Explorer. I have a series of pop ups on a particular page that are opened with JavaScript when help links are clicked. The JavaScript for them is: function openHelpPopUp(url) { newwindow=window.open(url,'name','width=620,height...

Javascript Question

I have a table with rows in the original state (A). When a postback occurs, I reorder these rows in the DOM (based on a business rule) using a JS function. It works fine except that the User experience is degraded when the rows are reordered. The sequence is as follows: 1. Display the rows in state A 2. Run a JS function that reorders ...

Obtaining Inner HTML From Iframe Using JavaScript

Hi friends i develop a project , in that i want to show the data from a website in the form of table . So i can do the process in child window iframe and get the table content from child window to the parent window . All are working fine , But this will work all browsers except ie. and it wont display any errors , One friend give the ans...