Thanks,
Bob
/////////////////////////////
EXAMPLE 1:
<html>
<head>
<title>Sample code</title>
<script language="Jscript">
function testFunction() {
var x = document.createDocumentFragment();
var y = x.appendChild(document.createElement('h4'));
y.appendChild(document.createTextNode('Hello'));
var z = x.appendChild(document.createElement('p'));
z.appendChild(document.createTextNode('I am a document
fragment'));
var b = document.getElementById('writebefore');
b.parentNode.insertBefore(x,b);
}
</script>
</head>
<body onload="testFunction()">
<div id=writebefore></div>
</body>
</html>
/////////////////////////////
EXAMPLE 2:
<html>
<head>
<title>Sample code</title>
<script language="vbscript">
sub testSub()
dim x, y, z, b, c
set x = document.createDocumentFragment()
set y = x.appendChild(document.createElement("h4"))
y.appendChild document.createTextNode("Hello")
set z = x.appendChild(document.createElement("p"))
z.appendChild document.createTextNode("I am a document
fragment")
set b = document.getElementById("writebefore")
b.parentNode.insertBefore x,b
end sub
</script>
</head>
<body onload="testSub()">
<div id=writebefore></div>
</body>
</html>
Seems like a bug to me...
Wrapping the 2nd argument with ()s to force pass by value works...
b.parentNode.insertBefore x,(b)
--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US