JavaScript – Blink Color Text Font in HTML

 

Blink can be used by blink tag in firefox mozilla but blink tag does not work in internet explorer. Blink color or text or font have to make own function which can help us to blink.

setTimeout function in JavaScript is used to blink certain property. Interval time is set in setTimeout method to blink at particalur time and call function in pre defined time which is defined in milliseconds. This is recursive function result in blinking of our text or color.

We have an example of blink with setTimeout function of JavaScript. This example is used to blink font by calling function again and again at specified time interval.

demo

<html>
<head>
<title>Blink color, text, font HTML</title>
<script>
function blinkFont()
{
  document.getElementById("blink1").style.color="red"
  setTimeout("setblinkFont()",1000)
}

function setblinkFont()
{
  document.getElementById("blink1").style.color=""
  setTimeout("blinkFont()",1000)
}


function blinkColor()
{
  document.getElementById("blink2").style.background="red"
  setTimeout("setblinkColor()",500)
}

function setblinkColor()
{
  document.getElementById("blink2").style.background="green"
  setTimeout("blinkColor()",500)
}

</script>
</head>

<body>
<div id="blink1">This font is blinking</div>
<div id="blink2">Color change with blink </div>
<br>
<input type="button" name="blinkFont" value="Blink Font" onClick="blinkFont()">
<input type="button" name="blinkColor" value="Blink Color" onClick="blinkColor()">
</body>
</html>

 

One Response to “JavaScript – Blink Color Text Font in HTML”

  1. shweta says:

    thank you so much..i really need it