settimeout

Recursion and setTimeout in JavaScript

I have a recursive function in my JavaScript file. It looks something like this: function process(node){ if(someCondition) return someValue; a = process(node.children); b = doSomething(a); return b; } The problem is that I want to display the state of the system to the HTML output on each step of this recursion...

setTimeout in loop to check for a change in bounds

This is my code: var b; while(!b){ setTimeout(function(){ alert('sss') b=1; }, 500); } and it will not alert 'sss' What can i do? Updated: I want to get bounds on google maps v3: function get_bounds(){ var bounds_; while(!bounds_){ setTimeout(function(){ ...

if I load a flv with netStream, how can I call a function when the flv stops playing

I have a website in ActionScript 3 that has lots of FLV animations that happen when you press buttons. Right now this is how I have it set up. in AS3, im loading FLv's (which are animations I exported in FLV form from After Effects) with net stream. I have a timer set up for the same amount of length of time that the animations (FLV's) ...

Using Javascript to Open a New Page and Populate Form Values There

I am using JavaScript in a bookmarklet to populate form elements on a website: javascript:var f = document.forms[0]; f.getElementsByTagName('input')[0].value = 'myname'; f.getElementsByTagName('input')[1].value = 'mypassword'; f.getElementsByTagName('input')[2].click This works. However what I would like to create is a bookmarklet so ...

Jquery mouseover mouseout menu using setTimeout

Can someone help me with this simple code.. I'm still a noob on js and I don't know what im doing wrong. Basically Im trying to make a mouseover menu. function showQuickLinks() { //show the menu } function hideQuickLinks() { //hides the menu } //button mouseover $("#quick-links-dd").mouseover(function() { showQuickLinks(); }); var m...

JavaScript redirect (location.href) breaks the Back button unless setTimeout() is used

I just came across some odd behavior in Firefox 3.6/Mac. I suspect that it's general Firefox behavior, though. I created two dead-simple test pages that change the window.location.href property to navigate to new URL: http://troy.onespot.com/static/stack_overflow/redirect.html http://troy.onespot.com/static/stack_overflow/redirect_tim...

calling a function in setTimeout

var my_new_function = function(){ ---- }; window.setTimeout(my_new_function, 1600); the above works properly without any errors. when i use: window.setTimeout("my_new_function()", 1600); it's working properly, but firebug is showing error : my_new_function is not defined in some articles about setTimeout, i found calling fun...

problem with setTimeout "function is not define" !

problem with setTimeout "function is not define" ! What is the problem in this code ? $(document).ready(function(){ function ISS_NextImage() { //ImageSlideShow NextImage $('.ImageSlideShow').each(function() { alert($(".correntImage", this).text()); }); } var t=setTimeout("ISS_NextImage();",1000); }); ...

jQuery delay vs. setTimeout for jackpot "spinner" image swapping

Scenario: I want to create a jQuery controllable jackpot "spinner" that will rapidly sequence a number of random images through a div before settling on one, with the delay interval between each equal but changeable. For mockup purposes, I'm simply changing CSS color classes to a box, although in the final I'll use background images. ...

x is not defined, setTimeout problem

With the following code I get a clock is not defined error, why? $(function(){ function clock() { var nd = new Date(); var h, m, s; h = nd.getHours(); m = nd.getMinutes(); s = nd.getSeconds(); if (h <= 9) h = "0" + h; if (m <= 9) m = "0" + m; if (s <= 9) s = "0" + s;...

Weird problem with setTimeout() on Google Chrome

I searched here and found a quick solution to call an action when the user is idle on the page. It basically works well on all browsers. But when I use an alert or a confirm dialog on the page, the weird problem occurs on Google Chrome. After the alert or confirm box disappears (Pressed OK, Cancel or Cross), the idle function works une...

Calling functions with setTimeout()

Simply put... why does setTimeout('playNote('+currentaudio.id+', '+noteTime+')', delay); work perfectly, calling the function after the the specified delay, but setTimeout(playNote(currentaudio.id,noteTime), delay); calls the function playNote all at the same time? (these setTimeout()s are in a for loop) or, if my explanation is...

How to periodically poll for data, but stop the Firefox page loading indication?

I need to have my web page periodically poll the server for new information every 10 seconds. I have a timer (setTimeout) setup to call my AJAX function to get the data. On completion, the AJAX function sets the timer for another 10 seconds. The problem is that Firefox continuously displays the "Page Loading Indicator" (Throbbing). H...

overriding a global function in javascript

I am trying to add my own error handling to the JavaScript setTimeout function. The following code works fine in chrome: var oldSetTimeout = window.setTimeout; window.setTimeout = function setTimeout(func, delay) { var args = Array.prototype.slice.call(arguments, 0); args[0] = function timeoutFunction() { var timeoutArg...

Jquery : delay fadeOut & clearQueue dosn't work ?

Hello, I don't understand why this code doesn't work : function Messages(type,text) { console.log("In function Message"); $("#message").clearQueue(); console.log("clearQueue :"+$("#message").queue("fx").length+" effet in queue"); if($("#message").length > 0 && $("#message").not(":visible").length == 1) { $("#...

confusion over setTimeout and clearTimeout

I have a button that changes the background of a div when its rolled over. the background needs to change on a timer so i have used setTimout to execute methods that change the backgrounds. I thought clearTimeout would cancel and timeouts i have set so i put this on the mouseleave event. However it doesnt seem to stop the timeouts. Is my...

How can i disable all setTimeout events

hello. i am using ajax and asp.net . i have a javascript function which creates many setTimeouted other javascript functions . after asynchronous postback happened i want to disable all of this setTimeouted events. thank you. ...

Jquery validation messages from xml

I am using Jquery valdiation plugin for validating the form at client side. I am fetching validation error messages from an xml file. $("#"+form).validate({ errorLabelContainer: "#dialogError", //msg_error wrapper: "li", rules: { txtInfringementID: { ...

JavaScript, moving wait bar, unexpected behavoir

I am trying to implement a moving waiting bar in JavaScript. This is supposed to be visible during an AJAX request. My initial code seems to work, but has the restriction that it can be used only once on the page, since there is only the variables timerW and stateW only appear once as global variable, and the element ids can also appear...

Can setTimeout ever return 0 as the id?

I am writing a check to see if a timeout is active. I was thinking of doing this: var a = setTimeout(fn, 10); // ... Other code ... where clearTimeout(a) can be called and set to null if (a != null) { // do soemthing } I was wondering if it would ever be possible that a will be 0. In that case I would use a !== null ...