Forum Moderators: open
does this help...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script type="text/javascript">
<!--
window.onload=function(){
dv=document.createElement('div');
txt=document.createTextNode('this is d3');
dv.appendChild(txt);
document.getElementById('container').appendChild(dv);
}
//-->
</script></head>
<body><div id="container">
<div id="d1">this is d1</div>
<div id="d2">this is d2</div>
</div></body>
</html>
birdbrain
<div id="container">
<div id="1">1</div>
<div id="2">2</div>
</div>
<script type="text/javascript">
function addToContainer()
{
// Get the parent node
var c = document.getElementById("container");
if(!c ) return;
// Create a new div
var d = document.createElement("div");
// Create a text node to go in the div
var t = document.createTextNode("Hello World!");
// Stuff the text node into the new div
d.appendChild(t);
// Add the new div to container
c.appendChild(d);
}
window.onload = addToContainer;
</script>
See the DOM spec for more info.
[w3.org...]