0
....
       <table id="tbl">
        <div id="xtra" style="display:none; visibility:hidden">
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div id="dname" style="display:none; visibility:hidden">
         <input name="Name[]" type="text" size="35">
        </div>
       </table>
....
           <input type="button"  
                  name="Add"
                  value="More Company" 
                  onclick="return AddRow();">
....


//the following javascript  function is saved in another .js file which is then called from the main php file when the above button is clicked. It works fine with Mozilla and Chrome.


function AddRow()
{
 var morerow=document.getElementById("tbl")
 var newtr=document.createElement("tr");
 var dname=document.getElementById("dname");

 morerow.appendChild(newtr);

 var newtd0 = document.createElement("td");
 newtd0.innerHTML = xtra.innerHTML;
 newtr.appendChild(newtd0);

 var newtd1 = document.createElement("td");
 newtd1.innerHTML = dname.innerHTML;
 newtr.appendChild(newtd1);
};

What's wrong with IE8?

3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by AdventDeo
0

Heya thank u man! It's working with IE now but it's not working with Mozilla... =(

Tried to add the following code but does not work... Any ideas how to make it work with both browsers?

if (navigator.appName=="Mozilla Firefox")
 var morerow=document.getElementById("tbl");
else if (navigator.appName=="Microsoft Internet Explorer")
 var morerow=document.getElementById("tbl").getElementsByTagName("tbody")[0];
0

First problem with your script, you are missing a ; on line 24.
Second problem, you haven't created a var called xtra which you try to use on line 31.

Also, why are you mixing DOM standard with innerHTML?

Lastly, this appears to be JavaScript, not PHP. For future reference, there is a JS forum here: Click.

Edited by Will Gresham: Typo

0

First problem with your script, you are missing a ; on line 24.
Second problem, you haven't created a var called xtra which you try to use on line 31.

Also, why are you mixing DOM standard with innerHTML?

Lastly, this appears to be JavaScript, not PHP. For future reference, there is a JS forum here: Click.

ok, apparently if you are referring to my first post the code works fine even with problem one and two with Mozilla. When i used the second post's code with IE, i realized i need to solve problem one and two, and hence my third post. I got first post's code off somewhere so i don't know about problem "also". And deepest and sincere apologies for not knowing that this a PHP or JS problem by my first post, I have make a new thread http://www.daniweb.com/forums/post1098769.html#post1098769 to solve problem "lastly", and marked this thread as solved. Cheers.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.