Adding the contents of a scrolling text box to a page after loading

Writing with JavaScript 4

This page was written many years ago. What I tried to do in these pages is now easy using W3C DOM. See this page. This page is of historical interest only!

Try entering some text in the scrolling text box below and pressing the button.

  I get a copy of the text appear in the table below:

  The code to do this is actually much simpler than the previous examples. The function is:

<script type="text/javascript">

<!--//

//start of function

function upDatePage(){

if (document.form1.textarea1.value!=''){

document.write('<FONT FACE="" COLOR="#0000FF" SIZE="3">The scrolling text box contains:</font>:<br />"'+

document.form1.textarea1.value+'"')

}

else {

document.write('<font face="" color="#0000FF" size="3">The scrolling text box is empty</font>')

}

}

//end of function

//-->

</script>

The code for the button is the same as before- we refresh the page:

<input type="button" value="BUTTON" name="B1" id="B1" onclick="history.go(0)" />

And finally, the code for the table is:

<table border="1" cellpadding="5" cellspacing="0" width="600">

<tr>

<td>

<script type="text/javascript">

<!--//

upDatePage()

//-->

</script>

</td>

</tr>

</table>

Ken Ward's HTML Guide...

 


[If you need to learn more about HTML visit the HTML Tutorial]

I am always pleased to hear from you.
Send your comments to