javascript

Reordering of table rows with arrow images for up and down?

I want to add small images-arrows for moving up and down on table row in Javascript (maybe jQuery) and save the reordered table (only the order) in cookie for further use. An example would be - Joomla, inside the admin area in the Articles area (but that is done with php). Thanks. ...

What thread does JavaScript code called from Flash execute on?

Hi, As far as I understand, all JavaScript code is event-driven and executes on a single browser thread. However, I have some JavaScript functions that are called from within a SWF object sitting on the same page. Is this code run in the same manner as regular JS code, or is it on some separate Flash thread? If it is on a separate thr...

jQuery: $().click(fn) vs. $().bind('click',fn);

When using jQuery to hookup an event handler, is there any difference between using the click method $().click(fn) versus using the bind method $().bind('click',fn); Other than bind's optional data parameter. ...

Dragging a rectangle over image

I'd like to be able to drag a rectangle over an image, and retrieve the coordinates of the end-points. Is there a library that'll take care of visualizing the rectangle as it's being dragged? ...

Make async event synchronous in JavaScript

I'm using the WPF 3.5SP1 WebBrowser control to display a page containing some javascript functions. My program then needs to invoke a javascript function which will make an asynchronous call. I need a way to get the result of that asynchronous call back to C# so I can process the result. Is there a way I can make the first javascript fu...

Referencing keys in a Javascript object

var foo = { someKey: "someValue" }; var bar = "someKey"; How do I get the value "someValue" using foo and bar? OK, the PHP equivalent: $foo = array("someKey" => "someValue"); $bar = "someKey"; print $foo[$bar]; // someValue So... I'm looking for the JS equivalent for the above, except I don't wanna use a JS array. Help please? ...

Data processing in HTML without server code (using just Javascript)

I was just wondering whether there is some way to do this: I have a form in a web page, after the user submits the form, the page is redirected to another static HTML page. Is there any way to manipulate the data in the second HTML page without the help of any server code? I mean can I display the form data that the user submitted in ...

jQuery Validator, programmatically show errors

I can do something like this: validator.showErrors({ "nameOfField" : "ErrorMessage" }); And that works fine, however if I try and do something like this: var propertyName = "nameOfField"; var errorMessage = "ErrorMessage"; validator.showErrors({ propertyName : errorMessage }); It throws an 'element is undefined' error. ...

How can I check whether a variable is defined in JavaScript?

How to check whether a JavaScript variable defined in cross-browser way? I ran into this problem when writing some JavaScript utilizing FireBug logging. I wrote some code like below: function profileRun(f) { // f: functions to be profiled console.profile(f.constructor); f(); console.profileEnd(f.constructor); } It wor...

Why use definition lists (DL,DD,DT) tags for HTML forms instead of tables?

I've come across a few examples recently that do things like: <dl> <dt>Full Name:</dt> <dd><input type="text" name="fullname"></dd> <dt>Email Address:</dt> <dd><input type="text" name="email"></dd> </dl> for doing HTML forms. Why is that? What is the advantage over using tables? ...

What is the more efficient way to delete all of the children of an HTML element?

I know that accessing and manipulating the DOM can be very costly, so I want to do this as efficiently as possible. My situation is that a certain div will always contain a list of items, however sometimes I want to refresh that list with a completely different set of items. In this case, I can build the new list and append it to that ...

JSONML vs. InnerHTML vs. ?

First of all, am I the only person using JSONML? And second of all, would you recommend using JSONML for inserting dynamic HTML or is InnerHTML more efficient? ...

Browsers no longer reporting js errors - YUI history manager

I'm using YUI's browser history manager, and my browsers no longer report runtime errors. They will still show a parse error in the error console, but if I call a bogus function, for example, inside some event handler, the browser just stops all js processing it seems. Even firebug's debugger will just quit when I get to a line with an e...

How do you manipulate selected text via a Firefox extension

I'm working on a Firefox extension that will manipulate highlighted text. On a stand-alone page, I can get the selected text with: selectedText = document.selection?document.selection.createRange().text; Then I'd manipulate the selected text with string operations on the textarea in question. Unfortunately, that isn't possible for a...

ASP.NET AJAX - Check for async postback via JavaScript

Does anyone know the script necessary to check to see if you are in a anync postback via JavaScript? Thanks. ...

Passing eventArgs to javascript from ASP.NET C# from OnClientClick

Hi, I have an asp button on my page, in the Page_Load on the code behind, I am binding some javascript calls as follows. btnExample.OnClientClicking = "functionOne(1,2);"+"function2()"; The problem is I would like to be able to pass the EventArgs passed to the Page_Load as in function2() I wish to call... eventArgs.set_cancel(true)....

Removing duplicates from 2d array in Javascript

What would be a nice algorithm to remove dupes on an array like below... var allwords = [ ['3-hidroxitiramina', '3-hidroxitiramina'], ['3-hidroxitiramina', '3-hidroxitiramina'], ['3-in-1 block', 'bloqueo 3 en 1'], ['abacterial', 'abacteriano'], ['abacteriano', 'abacteriano'], ['abciximab', 'abciximab'],...

Local javascripts turned off in a xulrunner based browser

Hi, I have an application which a xulrunner based browser embedded in it. I have to load some files which load flash content and are present on the local machine. These flash content change the page title and url at certain points. This entire setup works fine when I have the flash content in a remote browser but when I have it on my ma...

Is ruby strongly or weakly typed ?

Is ruby strongly or weakly typed ? Presumably the same is true for Javascript. ...

How to know when a program is open with javascript?

Hi, i have a problem, i want to know when a program is open with javascript.This is possible? ...