Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
JavaScript Category Code
Real Name
:
SharingCode.NET User
Subject
:
Periodically Updating the Text Displayed by an HTML Element
Description
:
Periodically Updating the Text Displayed by an HTML Element
<html> <head> <title>Replacing Text</title> <script language="JavaScript"> var msgIX = 0 var msgs = new Array( "Notice anything different?", "The text you are looking at has changed.", "This is a handy way of sending messages to your users." ) function scrollMessages(milliseconds) { window.setInterval("displayMessage()", milliseconds) } function displayMessage() { if(document.getElementById != null) { var heading = document.getElementById("scrollme") heading.firstChild.nodeValue = msgs[msgIX] }else{ if(navigator.appName == "Microsoft Internet Explorer") { var heading = document.all.item("scrollme") heading.innerText = msgs[msgIX] } } ++msgIX msgIX %= msgs.length } </script> </head> <body onload="scrollMessages(2000)"> <h1 align="center" id="scrollme">Watch this text very carefully!</h1> </body> </html>
Rating
:
4.00
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks