ginerjm Posted May 4, 2012 Share Posted May 4, 2012 The idea looks simple enough - so consequently I'm having a problem. This is a bit of html I have in a table that I generate via PHP that I want to modify on-the-fly with JS: echo "<tr class='pdata' id='row$i'><td>$k</td><td><input type='text' id='plyr$i' value='$v' size=3 maxlength=3 onchange='HandleSeedAssignment()'></td></tr>"; My JS function looks like this: function ShowPlyrs() { pobjs = document.getElementById('plyrtbl').getElementsByTagName("tr"); nobjs = pobjs.length; alert("found "+nobjs+" tr elements"); for (i=0;i<nobjs;i++) { pobj = pobjs[i]; if (pobj['className'] =='pdata') { document.getElementById(pobj.id).innerHTML = "<td>xyz</td><td>abc</td>"; } } return; } It all works EXCEPT the last line that is supposed to re-write the <tr> element. Running IE I'm getting "Unknown runtime error on line ###" which is the line putting out the new innerHTML. I've tried specifying my destination object a couple of ways. Originally I tried pobj.innerHTML = "<td>xyz</td><td>abc</td>"; but that didn't work either. Any ideas? I'm sure it's simple. Quote Link to comment https://forums.phpfreaks.com/topic/262094-playing-with-innerhtml/ Share on other sites More sharing options...
ginerjm Posted May 4, 2012 Author Share Posted May 4, 2012 Ok - been doing some reading. Some older posts found with G suggest that some elements are not re-writable with js. Table is one of them. So, if that is true, then I'll just have to alter my approach a bit. Hope this helps the next person. Quote Link to comment https://forums.phpfreaks.com/topic/262094-playing-with-innerhtml/#findComment-1343183 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.