Jump to content

Variable


zenon905

Recommended Posts

From the w3c docs I've read, I am not aware that the time of the first execution has been specified. Is it right away or is it after the interval? Could be at the brower's discretion. Or maybe I've missed something.To guarantee the performance you want, use setTimeout in a function and then call it recursively. That is, use setTimeout to call Function X, which calls setTimeout to call Function X . . . etc.setTimeout is guaranteed not to execute the assigned statements until the interval has expired.

Link to comment
Share on other sites

Well, maybe I should have run some tests before answering.FF/Mac and Safari work as you say. I made certain of this by initiating setInterval with a button click and keeping the interval 5 seconds long. No mistake. Both those browsers wait the full interval before executing the first time.I'll reserve further judgment till I've seen additional docs (my burden, not yours).ZENON:Do you call setInterval in a function or just inline in your script? 1000 milliseconds is just one second, not several. If the call is inline, much of that time could get eaten up during the loading of your document. You probably thought of that, but in case you hadn't . . .

Link to comment
Share on other sites

Also, a little short cut - feel free to ignore this post.This:

num++; document.getElementById('inf').value = num;

is equivalent to:

document.getElementById('inf').value = ++num;

Link to comment
Share on other sites

document.getElementById('inf').value = ++num;

C# my @$$. You're C hacker pure as the driven snow, am I right? Or you studied with one. I'll bet you even recognize this old gem:while (*x++ = *y++);If you're old enough, you might even yearn for the days when it was standard practice to hide flags and other cool stuff inside unused bit number 8."Why would anyone need more than 64K of ram?"
Link to comment
Share on other sites

Other question what's the document. code for making the background an image from my desktop?
Sorry. I don't understand. You want a file on your desktop to be the background of your web document? Are you serving from your desktop computer or a provider?
Link to comment
Share on other sites

What is yourObject?
The element object which you want to have the certain background. For example:
document.getElementById('inf').style.backgroundImage="url(image.jpg)";

will apply the background image on the element with an ID "inf".

Link to comment
Share on other sites

What if I want to apply it to the whole page?
You apply it on the html element.In CSS:
html {background: url(image.jpg)}

and the equivalent in java script:

document.documentElement.style.backgroundImage="url(image.jpg)";

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...