Simple Javascript Scroller
<html>
<head>
<title>Scrolling Demo2</title>
<script language=javascript>
<!--hide from old browsers
myMsg = " Hello there check out my scrolling message "
i=0
function scrollMsg() {
frontPart = myMsg.substring(i,myMsg.length)
backPart = myMsg.substring(0,i)
window.status = frontPart + backPart
if (i < myMsg.length) {
i++
}
else{
i=0
}
setTimeout("scrollMsg()",50)
}
//end hiding message -->
</script>
</head>
<body bgcolor=white onLoad="scrollMsg()">
<P> Here is another example using more compact JavaScript code</P>
</body>
</html>
Modified Script so scroller starts with a button
<html>
<head>
<title>Scrolling Demo2</title>
<script language=javascript>
<!--hide from old browsers
myMsg = " Hello there check out my scrolling message "
i=0
function scrollMsg() {
frontPart = myMsg.substring(i,myMsg.length)
backPart = myMsg.substring(0,i)
window.status = frontPart + backPart
if (i < myMsg.length) {
i++
}
else{
i=0
}
setTimeout("scrollMsg()",50)
}
//end hiding message -->
</script>
</head>
<body bgcolor=white>
<P> Here is another example using more compact JavaScript code</P>
<center>
<form>
<input type="button" value="Start Scroller" onClick="scrollMsg()">
</form>
</center>
</body>
</html>
Scroller inside a form box with start button
<html>
<head>
<title>Scrolling Demo3</title>
<script language=javascript>
<!--hide from old browsers
myMsg = " Hello there check out my scrolling message "
i=0
function scrollMsg() {
frontPart = myMsg.substring(i,myMsg.length)
backPart = myMsg.substring(0,i)
document.form.input.value = frontPart + backPart
if (i < myMsg.length) {
i++
}
else{
i=0
}
setTimeout("scrollMsg()",50)
}
//end hiding message -->
</script>
</head>
<body bgcolor=white>
<P> Here is another example using more compact JavaScript code</P>
<center>
<form name="form">
<input type="text" name="input" size="36"><br>
<input type="button" value="Start Scroller" onClick="scrollMsg()">
</form>
</center>
</body>
</html>
|