V
Vincent van Beveren
Hey everyone,
I try to insert a special character into my HTML using the DOM.
I do this by the following piece of code:
document.getElementById('space').
appendChild(document.createTextNode('<'));
Can anyone tell me why this does parse correctly if I use it in
the onLoad, but not in the function that I call directly from
the onload. You can run the code below in Netscape 7.1 or IE 6, it
gives the same result, so I'm sure I forgot something, but I can't
figure out what.
It prints:
This should be two smaller-then chars: <<
It should print:
This should be two smaller-then chars: <<;
Thanks,
Vincent
<html><head>
<script language="JavaScript">
function doItAgain() {
document.getElementById('space').
appendChild(document.createTextNode('<'));
}
</script>
</head><body onLoad="document.getElementById('space').
appendChild(document.createTextNode('<'));doItAgain();">
This should be two smaller-then chars: <span id="space"></span>
</body></html>
I try to insert a special character into my HTML using the DOM.
I do this by the following piece of code:
document.getElementById('space').
appendChild(document.createTextNode('<'));
Can anyone tell me why this does parse correctly if I use it in
the onLoad, but not in the function that I call directly from
the onload. You can run the code below in Netscape 7.1 or IE 6, it
gives the same result, so I'm sure I forgot something, but I can't
figure out what.
It prints:
This should be two smaller-then chars: <<
It should print:
This should be two smaller-then chars: <<;
Thanks,
Vincent
<html><head>
<script language="JavaScript">
function doItAgain() {
document.getElementById('space').
appendChild(document.createTextNode('<'));
}
</script>
</head><body onLoad="document.getElementById('space').
appendChild(document.createTextNode('<'));doItAgain();">
This should be two smaller-then chars: <span id="space"></span>
</body></html>