Forum Moderators: open
It would like to know if someone could help with a code in JavaScript. I have wanting to do a text ( link ) keep winking every 2 seconds, but do not be getting. I tried to search in the google, but did not find any script this way.
Will it it be what anybody could help?
Thank you very much to everybody.
It thus works: ( It winks white and red )
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
<html>
<head><script LANGUAGE="JAVASCRIPT">
<!--
state=0
function winks(){
if(state==0){
document.fgColor="#FF0000"
state=1
}else{
document.fgColor="#FFFFFF"
state=0
}
setTimeout("winks()",500)
}
//-->
</script>
<title>Wink - Wink</title>
</head>
<body onLoad="winks()">
<p>WINK</p>
</body>
</html>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
But I did not want to use onLoad, it wanted to do that for iD. I did this way:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
<html>
<head><script LANGUAGE="JAVASCRIPT">
<!--
local_spans = document.getElementById("local");
spans = local_spans.getElementsByTagName("td");
if(spans.id == "wink"){
state=0
function winks(){
if(state==0){
document.fgColor="#FF0000"
state=1
}else{
document.fgColor="#FFFFFF"
state=0
}
setTimeout("winks()",500)
}
}
//-->
</script>
<title>Wink - Wink</title>
</head>
<body>
<table>
<tr>
<td id="wink">WINK</td>
</tr>
</table>
</body>
</html>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
But thus does not work. Where that am I being mistaken?
Thanks.
<html>
<head><script LANGUAGE="JAVASCRIPT">
<!--
var state = 0;
function winks(){
var wi = document.getElementById('wink');
if(state==0){
wi.style.color = '#f00';
wi.style.fontWeight = 'bold';
state=1
}else{
wi.style.color = '#000';
wi.style.fontWeight = 'normal';
state=0
}
setTimeout("winks()",500)
}
//-->
</script>
<title>Wink - Wink</title>
</head>
<body>
<table>
<tr><td id="wink">WINK</td></tr>
<tr><td id="nowink">noWINK</td></tr>
</table>
<script language="JavaScript" type="text/javascript">
winks();
</script>
</body>
</html>