![]() | |
#1
| ||||||||
| ||||||||
|
|
I am trying to print out the array values for a second time but get error on page message? |
|
SCRIPT language="JavaScript" |
|
!-- |
|
function display_questions() { var questions= new Array(5) |
|
document.write("<input type='button' value='again' onclick='again()' / "); |
|
function again() { var i=0; for (i = 0; i<5; i++) |
|
{ document.write(this.questions[i] + "<br>"); |
|
input type="button" value="see questions" onclick="display_questions()" / |
#2
| |||
| |||
|
|
Generally, document.write is not the way to add content to a page that is already loaded. There are different ways to do that, either through the W3C DOM or using the proprietary "innerHTML" property. URL:http://jibbering.com/faq/#FAQ4_15 |
#3
| |||
| |||
|
|
On Fri, 02 Sep 2005 17:36:16 +0200, Lasse Reichstein Nielsen lrn (AT) hotpop (DOT) com> wrote: Generally, document.write is not the way to add content to a page that is already loaded. There are different ways to do that, either through the W3C DOM or using the proprietary "innerHTML" property. URL:http://jibbering.com/faq/#FAQ4_15 Lasse, Thanks for your comments - how does using "<div ID='"d_name">data</div>" work when I try to write out the 5 array values? Cheers Geoff |

![]() |
| Thread Tools | |
| Display Modes | |
| |