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.getEle mentById('space ').
appendChild(doc ument.createTex tNode('<'));
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="JavaS cript">
function doItAgain() {
document.getEle mentById('space ').
appendChild(doc ument.createTex tNode('<'));
}
</script>
</head><body onLoad="documen t.getElementByI d('space').
appendChild(doc ument.createTex tNode('<')); 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.getEle mentById('space ').
appendChild(doc ument.createTex tNode('<'));
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="JavaS cript">
function doItAgain() {
document.getEle mentById('space ').
appendChild(doc ument.createTex tNode('<'));
}
</script>
</head><body onLoad="documen t.getElementByI d('space').
appendChild(doc ument.createTex tNode('<')); doItAgain();">
This should be two smaller-then chars: <span id="space"></span>
</body></html>
Comment