From :
http://www.pageresource.com/jscript/jtimeout.htm

The SetTimeout Function<HEAD>
The SetTimeout Function
<SCRIPT language="JavaScript">
The SetTimeout Function
<!--hide
The SetTimeout Function
function newtext()

We use the HEAD section to define our two functions. The first function is named "newtext()". We call this function when the user clicks the button we created. As you can see, we changed the value of the text in the text box by using the name of the form and the name of the textbox:

document.myform.mytext.value="Hey! I have changed!";

The next command is what makes the second change happen. We call the function "moretext()" after 1000 milliseconds:

setTimeout("moretext()",1000);

Now, the function "moretext()" changes the value in the form box one more time, after waiting 1 second:

document.myform.mytext.value="I just change with the time!";

Now, in the BODY section, we simply put the code for the form and the textbox. Remember to give your form and your textbox names. That is how we are able to change the text in the box using the functions. The name for the form above was "myform", and the name of the text box was "mytext".

相关文章:

  • 2021-07-08
  • 2022-12-23
  • 2021-06-23
  • 2021-08-16
  • 2022-01-19
  • 2022-03-09
  • 2021-09-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案