Facebook Like Button

JavaScript

Till now, we were practicing Inline Scripting. i.e.(Script inside Body Tag)
This is the first example showing Internal Scripting. i.e.(Script inside Head Tag)
You can't see this script here live, due to certain limitations of Google. You have to save it in a HTML file and run it.
Here, I used a predefined method "setInterval("fnname_to_be_recalled",time_in_ms)".


Code:
<html>
<head>
<script type="text/javascript">
var i=0;
function blink() {
if(i==0){
idp.style.color="white";
i=1;
}
else{
idp.style.color="black";
i=0;
}
}
function repeat(){
setInterval("blink()",100);
}
</script>
</head>

<body onload="repeat()">
<div id="idp">Blinking Text</div>
</body>
</html>