Js simple implementation allows text box content to be displayed word by word

  • 2020-03-26 21:32:57
  • OfStack

 
<script language="JavaScript"> 
<!-- 
function MArray() { 
this.length = MArray.arguments.length 
for (var i = 0; i < this.length; i++) 
this[i+1] = MArray.arguments[i]} 
var fArray = new MArray; 
fArray[0]=" Welcome to the lecture javascript The language! "; 
fArray[1]=" Welcome to the lecture html The language! " 
fArray[2]=" Welcome to the lecture asp The language! " 
fArray[3]=" Welcome to the lecture vbscript The language! " 
var x = 1; 
var y = 0; 
var msg1 = fArray[y]; 
function newsSee() { 
if (x==msg1.length+1) { 
y+=1; 
if (y > 3) y=0; 
document.form1.news2.value=' '; 
msg1 = fArray[y]; 
x=0;} 
document.form1.news2.value=msg1.substring(0,x); 
x+=1; 
setTimeout("newsSee() ",100); 
} 
// --> 
</script> 
<body onLoad="newsSee()"> 
<form name="form1"> 
<p align=center><input type="text" name="news2" size=40></p> 
</form> 
</body> 

Related articles: