|
-
Oct 9th, 2003, 09:34 AM
#1
Thread Starter
Fanatic Member
Changing Bgcolor
I want a timer to change the bgcolor every second. So here is what I have so far:
<html>
<head>
<Body bgcolor = "Black">
<script type="text/javascript">
function start() {
var timeout = setTimeout("Timeout();",2000);
}
function Timeout() {
<Body BGcolor = "Red">
var timeout = setTimeout("Color2();",1000);
}
function Color2() {
<Body BGcolor = "Green">
var timeout = setTimeout("Color3();",1000);
}
function Color3() {
<Body Bgcolor = "Lime">
}
</script>
</head>
<body onLoad="start()">
</body>
</html>
-
Oct 9th, 2003, 10:59 PM
#2
Re: Changing Bgcolor
<script type="text/javascript">
function start() {
var timeout = setTimeout("Timeout();",2000);
}
function Timeout() {
document.bgcolor = 'red';
var timeout = setTimeout("Color2();",1000);
}
function Color2() {
document.bgcolor='green';
var timeout = setTimeout("Color3();",1000);
}
function Color3() {
document.bgcolor='lime';
}
</script>
-
Oct 10th, 2003, 08:58 AM
#3
Thread Starter
Fanatic Member
I cant figure out was is wrong with this code. I put the code in notepad. And it doesnt do anything:
Code:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
<HTML>
<Body>
<script type="text/javascript">
function start() {
var timeout = setTimeout("Timeout();",2000);
}
function Timeout() {
document.bgcolor = "Red";
var timeout = setTimeout("Color2();",1000);
}
function Color2() {
document.bgcolor="green";
var timeout = setTimeout("Color3();",1000);
}
function Color3() {
document.bgcolor="lime";
}
</Body>
</script>
</HTML>
-
Oct 10th, 2003, 09:51 AM
#4
<?="Moderator"?>
there isnt anything calling the first function called start.
Code:
<HTML>
<Body>
<script type="text/javascript">
function start() {
var timeout = setTimeout("Timeout();",2000);
}
function Timeout() {
document.bgcolor = "Red";
var timeout = setTimeout("Color2();",1000);
}
function Color2() {
document.bgcolor="green";
var timeout = setTimeout("Color3();",1000);
}
function Color3() {
document.bgcolor="lime";
}
start(); /*----that should start it off*/
</Body>
</script>
</HTML>
but your codfe will only change the colour threes times, if u want to loop it again you need to add stuff in to your functio Color3
-
Oct 10th, 2003, 10:11 AM
#5
Thread Starter
Fanatic Member
It just sat there and didnt do anything. I have no clue what is wrong.
-
Oct 10th, 2003, 12:24 PM
#6
You're trying to run this from notepad????
Tell me I read that wrong.
-
Oct 10th, 2003, 01:33 PM
#7
Thread Starter
Fanatic Member
I type the code into notepad. Then change the file extension to .html Then open it as a web document. I may be an idiot when it comes to HTML but im not that big of one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|