|
-
Jan 12th, 2006, 01:33 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] div -background color
Hi,
I am tring the change the background-color of a layer in every 10 seconds
but get an error message...will you please fix the problem..?
thanks
VB Code:
<html>
<head>
<script>
var con=0;
setInterval(" degis() ", 2000)
function degis()
{
con++;
document.getElementById("mytext").value=con
if (con==5)
{
document.getElementById(" mydiv ").value=blue;
}
}
</script>
</head>
<body>
<div id=mydiv style="position:absolute;top:1;left:0; color:red;width:1020;height:120;z-index:-1;">
hello there......
</div>
<form>
<input type=text id="mytext" size=3 style="position:absolute;top:200;left:200;font-size:14pt;"><br><br>
<input type=button value="print the nums..." style="position:absolute; top:400; left:200; onClick:'degis()';"><br><br>
</form>
</body>
</html>
Last edited by merhaba; Jan 12th, 2006 at 02:25 PM.
-
Jan 12th, 2006, 03:05 PM
#2
Frenzied Member
Re: div -background color
Is this what you want?
Code:
<html>
<head>
<script>
var con=0;
setInterval("degis()", 2000)
function degis()
{
con++;
document.getElementById("mytext").value=con
if (con==5)
{
document.getElementById("mydiv").style.color="blue";
}
}
</script>
</head>
<body>
<div id=mydiv style="position:absolute;top:1;left:0; color:red;width:1020;height:120;z-index:-1;">
hello there......
</div>
<form>
<input type=text id="mytext" size=3 style="position:absolute;top:200;left:200;font-size:14pt;"><br><br>
<input type=button value="print the nums..." style="position:absolute; top:400; left:200; onClick:'degis()';"><br><br>
</form>
</body>
</html>
-
Jan 12th, 2006, 03:40 PM
#3
Thread Starter
Fanatic Member
Re: div -background color
Thanks Vbbit,
but what you have done does not change the "background color"...
it works only for the text...
I still need help....
-
Jan 12th, 2006, 05:03 PM
#4
Frenzied Member
Re: div -background color
Change the line that is red to :
document.getElementById("mydiv").style.background="blue";
I hope this is exactly what you want
-
Jan 12th, 2006, 05:08 PM
#5
Thread Starter
Fanatic Member
Re: div -background color
ok thanks
what about this ?
How can I use a variable here?
...........................
var anycolor;
anycolor="red";
document.getElementById("mydiv").style.color=anycolor;
...................................................
-
Jan 12th, 2006, 05:13 PM
#6
Frenzied Member
Re: div -background color
That should work and would give you a red background/text in 5 sec.
-
Jan 12th, 2006, 05:24 PM
#7
Thread Starter
Fanatic Member
Re: div -background color
well done vbbit,
it works
Thank you...
-
Jan 12th, 2006, 05:39 PM
#8
Thread Starter
Fanatic Member
Re: [RESOLVED] div -background color
document.getElementById("mydiv").style.backgroundColor=mycolor;
this works ,too
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
|