simple js doesn't work with IE7 (work with FF1.5)

This is a discussion on "simple js doesn't work with IE7 (work with FF1.5)" within the JavaScript Forum section. This forum, and the thread "simple js doesn't work with IE7 (work with FF1.5) are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 10th, 2007, 10:46
New Member
Join Date: Jun 2007
Location: Israel
Age: 37
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
simple js doesn't work with IE7 (work with FF1.5)

Hi,
With IE7, the following code doesn't add the table to the page when button is clicked.
the code is also uploaded to http://startupisrael.com/gpazi/triptouch/test.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<script language="Javascript" type="text/javascript">
function func()
{
var mydiv = document.getElementById("mydiv");

var mytable = document.createElement("table");
var mytr = document.createElement("tr");
var mytd = document.createElement("td");
var mytext = document.createTextNode("this is my text");
mytd.appendChild(mytext);
mytr.appendChild(mytd);
mytable.appendChild(mytr);
mydiv.appendChild(mytable);
}
</script>

<div id="mydiv"><button onclick="func();">click</button></div>
</body>
</html>
Reply With Quote

  #2 (permalink)  
Old Jun 10th, 2007, 11:00
New Member
Join Date: Jun 2007
Location: Israel
Age: 37
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: simple js doesn't work with IE7 (work with FF1.5)

got the answer -
IE requires a tbody element to insert a table using the DOM
Reply With Quote
Reply

Tags
js javascript ie

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript menu - does not work on title page, but does work on other pages Crystal Phoenix Starting Out 4 Mar 24th, 2008 19:40
Why does this work? masonbarge JavaScript Forum 1 Jan 1st, 2008 20:53
Why does this work? Kropotkin Web Page Design 9 Aug 6th, 2007 13:24


All times are GMT. The time now is 19:51.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43