Sunday, August 23, 2015

Dynamic positioning (TEXT GROWING IN HTML) USING JS

<html>
<head>
<script>
var flag=1,fontsize=2;
function start()
{
setInterval("change()",100);
}
function change()
{
h.style.fontSize=fontsize;
h.innerText+=fontsize;
if(fontsize==500)
fontsize=0;

fontsize++;
if(flag==1)
{
document.body.style.backgroundColor="red";
flag=0;
}
else
{
document.body.style.backgroundColor="green";
flag=1;
}
}

</script>
</head>
<body onload="start()">
<p id="h">Hi Welcome</p>

</body>
</html>

No comments:

Post a Comment