•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 425,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,645 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 8178 | Replies: 5
![]() |
•
•
Join Date: Mar 2005
Location: Ottawa, Ontario, Canada
Posts: 959
Reputation:
Rep Power: 5
Solved Threads: 2
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]<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>[/HTML]
Thanks for helping.
[HTML]<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>[/HTML]
Thanks for helping.
You will be happy to know that this works in Firefox, but not in Internet Explorer. I'm not sure what the exact problem is, but it has something to do with the DOM and browser compatibility. If I figure it out I will let you know.
•
•
Join Date: Mar 2005
Location: Ottawa, Ontario, Canada
Posts: 959
Reputation:
Rep Power: 5
Solved Threads: 2
•
•
Join Date: Mar 2005
Location: Ottawa, Ontario, Canada
Posts: 959
Reputation:
Rep Power: 5
Solved Threads: 2
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- display:block to show a table? (JavaScript / DHTML / AJAX)
- Screen just wont show anything (Troubleshooting Dead Machines)
- msn messenger..contacts display pictures wont show (Windows NT / 2000 / XP / 2003)
- msn messenger...wont show contacts display pics (Windows Software)
- Need help diplaying null values (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: How do i color something like a blueprint?
- Next Thread: Date function in Drop-Down Box


Linear Mode