javascript

Detecting memory leaks in JavaScript

I have this code, I used this on some of JavaScript components I built for a project. Now I want to know if is there a memory leak on the following code. Which of the options is most appropriate, A or B or is there a better way? var component = function(){ var self = this; //A - not sure there's a leak here this.foo = function...

Javascript getElementById acting odd...

I'm using a for loop to cycle through some elements with a starting value (seats on a plane). Here it is: seatNum - Number of seats to be cycled through startSeat - seat to begin cycling I'm calling the function from a form "onsubmit". The problem comes in the for loop when i try and go get elements with an id naming convention of "s1...

Alternatives for using "#" in href attribute

Possible Duplicate: Href for Javascript links: # or javascript:void(0)? Hi everyone.... This question has been bugging me for a long time and thought it's time to hear what the experts think about it... ;) Here goes... The tag is used to create hyperlinks but in this age of jquery and ajax we are using it to load html int...

Should I avoid javascript , jquery, flash, ajax, silverlight if i want to make my site cross platform compatible and screen reader compatible?

Should I avoid JavaScript , jQuery, flash, Ajax, Silverlight if i want to make my site cross platform compatible (PC, iPHONE other mobiles, PDA) and Accessible(screen reader compatible)? Should i only use xhtml css with server side language for wider accessibility? and for PC pr MAC i made everything first for Firefox so for mobile whi...

How to add Google AutoComplete/AutoSuggest feature in rails using Google Ajax API ?

I have successfully integrated google ajax search with rails application . Does Google Ajax Search Api provides api for autocomplete/autosuggest feature in rails application ? . Is there a way to integrate google search autocomplete feature in Rails ? Any body worked on the same please share your experience . Thanks !! ...

How to implement something like www.igoogle.com?

The main problem is: How do they deal with the intersection of two blocks? EDIT Javascript is one thing,the other thing is: how do they remember the position of each block? ...

controlled saving in jqgrid cell editing

that's about it Basically what I want to do is control the cell submission with a button or any other control. Has anyone done this? Here's some code to help: $('#users').jqGrid({ url : base_url + 'administrator/ajaxuser', datatype : 'json', mtype : 'GET', colNames : ['ID', 'E-mail' , 'First Name', 'Last Name'...

IE8 will report error about for in without declaring var item?

Like : var result = eval('(' + response + ')'); var html = value = ''; for(item in result) { } response is a json response. It stops at for.. in IE8. How to fix that? EDIT I got the same error when running: result = [1,2,3]; for(item in result) { ... } ...

Jquery slide problem. can anyone help.

i create a jquery slide which i want the 2 picture 1 slide in from left and other 1 slide in from right. Finally the picture can slide in from left but cant slide in form left. izit anything wrong of my code?? Any suggestion?? <script type="text/javascript"> $(document).ready(function() { $('.slideshow').cycle({ fx: 'custom',...

issue in javscript in checkboxlist

hi, this is my Javscript which behaves like an Radiobutton. where user can select only 1 option at a time (ex: if he select item1 and selects item2 then item1 gets deselected, as he as selected item2 if he clciks again on item2 it gets deseletced.) which make user either select any one item or deleselect the selected item to th...

Javascript splice not splicing

tl;dr; Even without my explanation one can look at the code below and the output and see something is fishy. Splice returns the index it spliced but the data remains in the array. So I have an object that's keyed almost like an array (0,1,2,3...etc). Each object key has an array value. The array is an array of objects. Here's a simp...

how to call [object htmlDivElement]

hi, i want to call the functions movein(this) & moveout(this) directly with out using onmouseover or onmouseout by the way (this) is [object htmlDivElement] var tb = '<div id="' + o.id + '" onmouseover="movein(this);" onmouseout="moveout(this);"><div><table>\n'; ...

JQuery: Image Path is different in IE7

My Problem: I have some Images in the div (ImageRoller) In the variable "CurrentImage" i have saved a path to one of the image By the function "ShowNextImage" i want to have the image path of the next image: ("Images/Frangipani Flowers.jpg") It works in FF and all normal Browsers, but not in IE. IE searches in this part (img[src='" +...

How can I pass a custom argument to an event listener in JavaScript?

How can I add an event listener (addEventListener(),attachEvent()) that also accepts a parameter? The parameter is passed as the element's custom attribute like: <img src="icon.gif" alt="Test button" command="test" /> <img src="icon2.gif" alt="Test button2" command="write" /> ...

Adding a global Javascript function, jQuery style?

Im looking to send command strings to a flash app, to execute debug commands. Doing this through Firebugs Console/Command-line looks like the simplest way to get this up and running. At the moment I can log to the firebug console from the flash app by calling out to console using the ExternalInterface. And also send the flash app comman...

Getting thickbox to open when the body loads

The code below is my attempt at getting my thickbox video player to open when the body loads. Can someone tell me what i'm doing wrong? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="...

show div for a set time, then hide it

Im using jquery for various things on my site, but one thing im not sure how to do, is have it show an element, then wait X seconds, and hide the element. $('#form').ajaxForm(function() { $('#cartcontents').fadeOut("fast").load('cart.php').fadeIn("fast"); }); Thats the js im using now. How could i have it (on submit) display the div...

Python to Javascript

Hi everyone, are there any tools for Windows to convert python to javascript? regards Alberto ...

Using javascript history.back() fails in Safari .. how do I make it cross-browser?

I am using <a href="index.php" onclick="history.back();return false;">Back</a> to provide a back to previous page link. It works fine on Windows (IE/Mozilla) but fails in Safari on both Windows/Mac. Is there a way to make it work on all of the systems/browsers (cross-browser/platform)? If it's not possible, is there any other way u...

How to write javascript function to check JRE version

Hi all, I am new to javascript. How to write javascript function which will return installed java version in the computer. Thanks Sunil Kumar Sahoo ...