![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
function funPrintButtons() { document.write("<input type = 'button' value='Grade Quiz' onclick='funGradeQuiz()'>"); document.write("<input type = 'button' value='Refresh Quiz' onclick='location.reload()'>"); } // end funPrintButtons snip body onLoad = "funInitialize(); funPrintQuestions(); funPrintButtons();" snip |
#2
| |||
| |||
|
|
"Shock" <shock56 (AT) charter (DOT) net> wrote in message news:votqdda7n8fh65 (AT) corp (DOT) supernews.com... snip function funPrintButtons() { document.write("<input type = 'button' value='Grade Quiz' onclick='funGradeQuiz()'>"); document.write("<input type = 'button' value='Refresh Quiz' onclick='location.reload()'>"); } // end funPrintButtons snip body onLoad = "funInitialize(); funPrintQuestions(); funPrintButtons();" snip You are calling document.write after the original document has been closed (in the onload event). That will result in the current document being cleared and replaced, and when it is cleared all of the JavaScript functions go with it. Richard. |
#3
| |||
| |||
|
|
Sorry, I am not sure I understand. I thought document.write simply wrote the line into the document. When was the document closed? |
#4
| |||
| |||
|
|
"Shock" <shock56 (AT) charter (DOT) net> writes: Sorry, I am not sure I understand. I thought document.write simply wrote the line into the document. When was the document closed? The document was closed when it finished loading, i.e., *just* before the document's onload event happens. While loading the page, the page is processed from top to bottom. A script is executed when this process reaches it, and a document.write inserts content between the script that calls it and the remaining, unprocessed, code. When processing reaches the end of the document, it is finished. This closes the document and then calls the onload handler. That means that document.write's in the onload handler will reopen, and thereby clear, the document. /L -- Lasse Reichstein Nielsen - lrn (AT) hotpop (DOT) com Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html 'Faith without judgement merely degrades the spirit divine.' |
#5
| |||
| |||
|
|
"Shock" <shock56 (AT) charter (DOT) net> writes: Sorry, I am not sure I understand. I thought document.write simply wrote the line into the document. When was the document closed? The document was closed when it finished loading, i.e., *just* before the document's onload event happens. While loading the page, the page is processed from top to bottom. A script is executed when this process reaches it, and a document.write inserts content between the script that calls it and the remaining, unprocessed, code. When processing reaches the end of the document, it is finished. This closes the document and then calls the onload handler. That means that document.write's in the onload handler will reopen, and thereby clear, the document. /L -- Lasse Reichstein Nielsen - lrn (AT) hotpop (DOT) com Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html 'Faith without judgement merely degrades the spirit divine.' |
![]() |
| Thread Tools | |
| Display Modes | |
| |