[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>
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>
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....
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
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;
...................................................
Re: div -background color
That should work and would give you a red background/text in 5 sec.
Re: div -background color
well done vbbit, :wave:
it works :thumb:
Thank you...
Re: [RESOLVED] div -background color
document.getElementById("mydiv").style.backgroundColor=mycolor;
this works ,too