*RULES FOR REPLYING TO POST
DO NOT REPLY TO THIS POST TO STATE YOUR OPINION OF A DIFFERENT SUBJECT OTHER THAN THE SUBJECT THAT THIS THREAD IS CREATED FOR.
For the record the subject is “Document.write” has an annomile of some sort. If it is NOT RELATED to this subject DO NOT POST A REPLY!
Now that I got that out of the way; I am programming in JavaScript and I am purposefully NOT trying to couple my code to the “java” framework or to Microsoft IE or anything else for that matter. I am using very broad terms for the reason of “portability” and in this case I am attempt to use 1 specific function which “writes to the document” Document.write.
The specifics are as follows.
I initate a “javascript PROGRAM” not a javascript function but rather an entire loop which never ends until the user exits the site. This loop is initalized on the <body onload=”runProgram()”> tag. Where ‘runProgram’ is executed and all the eternal specifics of the code are created.
In this case I have a document.write(someValue); function which is being called or invoked. The invoker is a sub routine within the document. The purpose is to render to the screen some <div> statements which is typical for DHTML.
before the Document.write statement (for testing I placed an alert()? and after a for loop where the document exits I placed another alert(); to signifiy that the code was executing.
For all intents and purposes the code looks similar to this.
.
.
.
alert(“start Document Write.”);
var divOpenHTML = “<div>”;
var divCloseHTML = “</div>”;
document.write(divOpenHTML);
for (x=0; x<100; x++)
{
document.write (“line ” + x + divOpenHTML + “<someText>” + divCloseHTML);
}
document.write(divCloseHTML);
alert(“done rendering document writes”);
.
.
.
The problem is that the Document.write(…); statement does not seem to execute at all. The alerts fire, and everything appears to run without error; but the code never renders to screen. Essentially somehow I have nullified the Document.write function all together, and I can’t figure out what I did.
I am looking for any ideas, suggestions, or knowledges on known Document.write errors?
For the record I used the evaluator at [url]http://www.w3schools.com/js/tryit.asp?filename=tryjs_text
use the following code
<code>
<html>
<head>
<script type=”text/javascript”>
function a()
{
document.write(“<DIV style=’border:1px solid #000000;’>”);
for (y=0;y<100; y++)
{
for (x=0;x<200; x++)
{
document.write(“line ” + x + “, ”
+ y + ” write to doc directly!<BR>”);
}
}
document.write(“</DIV>”);
}
</script>
</head>
<body>
this is test data<BR><BR>
<script type=”text/javascript”>
document.open();
document.write(“writeing to document directly! Open”);
</script>
<div onClick=”a()”>!!!!!!!Write to document !!!!!!!</div>
<script type=”text/javascript”>
document.write(“writeing to document directly! Close”);
document.close();
</script>
</body>
</html>
</code>