The setTimeout function always seems to give me trouble. Right now I have a function that is recursive (calls itself through setTimeout) and changes the elements height.
The function is sent two arguments: the element to be altered and that elements maximum height. The purpose of the function is to unfold the element, or "slide down" at...
I am trying to develop a slideshow with a pause between slides. So I'm trying to use the setTimeout statement as shown below. This is written to swap 2.jpg for 1.jpg with a pause of 10 seconds on clicking the button. But it does now work. Can anyone help me. Thanks.
<html>
<head>
<script type="text/javascript">
var t;
function swap(newI...
I have a horizontal scroll created in javascript that works in IE
and Chrome, however I get a flicker in Firefox 2 and 3. The div
that is moving contains an iframe with images and text with absolutely
positioned divs. (see code below.)
Problems:
1) The content appearing in either the div to the left or the right of
the animating d...
function testFun() {
onerror = function() { log("caught the error"); return true; };
setTimeout(function() { throw "bad bad bad"; }, 300);
};
This is sample, code, but it demonstrates a problem.
If I run this in FF, or IE7, it prints the sensible "caught the error" message (assume a reasonable 'log' function).
However if I deb...
Every 3 seconds I make an AJAX POST request to get the status of a process. This works great.
When the process reaches 100% a call back function executes(indicated below) to add new elements to the page and then it cancels the setTimeout method that use to continuously get the progress every 3 seconds. However, I have been told by my u...
Hello,
I am trying to create a simple ajax chat using JQuery and ASP.NET. My code works like this:
When the page loads it refreshes the 'chatbox' div with a request to the messages.aspx page, which handles getting new messages from the database and kicks off an auto refresh with the setTimeout().
Whenever the user clicks the send b...
Is there anything readily available in JavaScript (i.e. not through "plugins") that allows me to do something like setTimeout, but instead of saying in how many milliseconds something should happen, I give it a date object telling it when to do something?
setToHappen(function () {
alert('Wake up!');
}, new Date("..."));
And yes, I...
When using setTimeout, you have to put the code you want to execute into a string:
setTimeout('alert("foobar!");', 1000);
However, I want to execute a function to which I have a reference in a variable. I want to be able to do this:
var myGreatFunction = function() { alert("foobar!"); };
// ...
setTimeout('myGreatFunction();', 1000);...
I'm wondering how I get a smooth zoom in animation with the Google Maps API.
I have 2 points, one in, let say China, and one in France. When I'm zoomed in on China, and click the button France. I want it to gradually zoom out smooth, one zoom level at the time. When it's zoomed out it should pan to the new location, and then zoom in on ...
Two questions:
How is the value returned from setInterval and setTimeout (the ones used to clear the timers) calculated?
Is it possible for both the functions to return the same value during runtime?
For example:
var a = setInterval(fn1, 1000);
var b = setTimeout(fn2, 1000);
Is it possible for a and b to have the same value?
The fi...
Hi,
I have this piece of code, and it doesn't work as I expect (it's demo code, distilled from a larger program):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Test</title>
<script language="javascr...
Hello,
my problem is that I can not stop a timer.
I had this method to set a timeout from this forum.
It supposed to store the identifyer in the global variable.
By accident, I found out that it is still running after I hide "mydiv".
I also need to know now, if the recursive function creates multiple instances or just one for the ti...
I have two sets of boxex on a page. 10 boxes belonging to class 'boxOne'
and another 10 belonging to class 'boxTwo'
There is a button. On click of button I am using jquery effect to highlight and then fade the background color of all the element belonging to class 'Boxone' and 'Boxtwo'.
Below is the code.
var colorOfBox1 = "'" + $(.box...
Hello, just a short qustion ..
I have a drop down menu. Now when it's slided down to multiple levels, I'd like it to add wait time for like 2 secs, before it disapears, so the user can get back in, when he breaks the .hover() by mistake ... Is it possible?
my code for the slide:
$('.icon').hover(function() {
$('li.icon > ul').sli...
hi, the code below..why i can not use the setTimeOut within an javascript object?
Message = function () {
...
...
this.messageFactory = ...
this.feedbackTag = document.getElementById('feedbackMessages');
this.addInfo = function (message) {
var info = this.messageFactory.createInfo(message); // crea...
I have a timer that counts down every second. It works great until the user opens up 3 or 4 tabs of the my site, at which point the newest tab's timer goes double or triple speed. I can currently only reproduce the bug in IE8. I was previously using setInterval, and could reproduce the bug in Firefox as well.
I'm actually using FBJS (...
I have a trivial little game I wrote in javascript that creates a wave from where you click. I figured out two ways to make the "wave" move across the screen:
by calling jQuery.animate() with increasingly large times. demo
by recursvely calling setTimeout. demo
The problem I have is that I want the behavior of 2 (columns all grow at...
I have some JavaScript code that looks like:
function statechangedPostQuestion()
{
//alert("statechangedPostQuestion");
if (xmlhttp.readyState==4)
{
var topicId = xmlhttp.responseText;
setTimeout("postinsql(topicId)",4000);
}
}
function postinsql(topicId)
{
//alert(topicId);
}
I get a error that topicId is not defin...
I've created a script that fades the background color of an element. I use setTimeout() to make an incremental change to the color every 5 ms. The script works great if I'm just fading the background color of one thing at a time, but if I've got, say, 50 elements I'm all fading at once, the speed is much slower than 5 ms because of all t...
ok, so I've got this code:
$(this).find('article.loading').each( function(i) {
var el = this;
setTimeout(function () {
$(el).replaceWith($('#dumpster article:first'));
}, speed);
});
I want to replace each element with another but I want a delay between each replace.
I can't figure out why this isn't working...