Pages

Wednesday, May 25, 2011

Java Script: Text Sliding in a Page.

How to display Text banners in a HTML Page?
We can achieve this using Java Script.
The following piece of Code will do this.

<html>
<head>
<title>Test</title
 
<SCRIPT type="text/javascript">
var quotations = new Array()
quotations[0]= "Text 1"
quotations[1]= "Text 2"
quotations[2]= "Text 3
 
function display()
{
a=Math.floor(Math.random()*quotations.length)
document.getElementById('quotation').innerHTML=quotations[a]
setTimeout("display()",4000) // Once in 4 Seconds, the text will be changes.
//Seconds  specified in milli seconds.
} 
</SCRIPT>

</head>
<body>
<div id="quotation">
<SCRIPT type="text/javascript">display()</SCRIPT>
</div>
</body>
</html
 

No comments:

Post a Comment