I've come up with this code and cant figure out why nothing appears when I press the button. The table is soposed to show. Probably something really simple cuz I often stuck on stupid things.
<html>
<head>
<script type="text/javascript">
function appendtable() {
var div = document.getElementById("divide");
var ControlsDesign = document.createElement("div");
var table_cd = document.createElement("table");
var tr_cd = document.createElement("tr");
var td_cd = document.createElement("td");
var table_content = document.createElement("table");
var tr = document.createElement("tr");
var td = document.createElement("td");
var t = document.createTextNode("Some text");
td.appendChild(t);
tr.appendChild(td);
table_content.appendChild(tr);
td_cd.appendChild(table_content);
tr_cd.appendChild(td_cd);
table_cd.appendChild(tr_cd);
ControlsDesign.appendChild(table_cd);
div.appendChild(ControlsDesign);
alert(document.getElementById("divide").innerHTML);
}
</script>
</head>
<body bgcolor="#999999">
<div id="divide" height="100"></div><input type="button" onclick="appendtable()" value="Press me">
</body>
</html>
Thanks for helping.