Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blink in IE 1

Status
Not open for further replies.

oaklandar

Technical User
Feb 12, 2004
246
US
Currently my Netscape Browser supports the blink tag:
<blink>blinking text</blink>

It doesnt work in IE. Please advise how I can get it to work in IE using Javascript?
 
Since IE doesn't inherently support blink, you have to code your own with a timeout:
Code:
<script language=javascript>

function blinky(str, bool) {
   obj = document.getElementById(str);
   obj.style.visibility = (bool) ? "visible" : "hidden";
   window.setTimeout('blinky("blinkSpan", ' + !bool + ')', 500);
}

</script>
<body onload='blinky("blinkSpan", true)'>
<form name=blahForm>
<span id=blinkSpan>This is a Blink Test</span>
</form>
</body>

-kaht

banghead.gif
 
Thanks, but I am totally lost and not familiar with what is going on in the function part?
Can you please explain some areas if you have time?

Code:
function blinky(str, bool) 
{
   obj = document.getElementById(str);
   obj.style.visibility = (bool) ? "visible" : "hidden";
  //this line translates....document.getElementById(str).style.visibility = (bool) ? "visible" : "hidden";
....please advise what exactly it is doing?
   window.setTimeout('blinky("blinkSpan", ' + !bool + ')', 500);
//lost on what this is doing and how you are calling blinky function inside of blinky function?
}

Thanks again.







 
function blinky(str, bool)
{
obj = document.getElementById(str);
obj.style.visibility = (bool) ? "visible" : "hidden";

Check out this thread about the ? operator. It should help you understand what's going on. bool is a boolean variable passed to the function
thread216-897851

window.setTimeout('blinky("blinkSpan", ' + !bool + ')', 500);

Do a google search for "javascript setTimeout" and this will make a little more sense. Notice the !bool so that the boolean variable flips : true, false, true, false, true, etc.
}

-kaht

banghead.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top