garethhall Posted February 12, 2010 Share Posted February 12, 2010 I have the code below and works fine in firefox ans safari but I get an IE error. Can you guys tell me way? As far as I can tell the error is caused by appendChild() Many thanks <script type="text/javascript"> var theNo = Math.floor(Math.random()*9999); var spm = document.createElement('input'); spm.setAttribute('type','hidden'); spm.setAttribute('name','spamHidden'); spm.setAttribute('id','spamHidden'); spm.setAttribute('value',theNo); document.getElementById('frm').appendChild(spm); </script> Link to comment https://forums.phpfreaks.com/topic/191845-ie-error-unable-to-modify-the-parent-please-help/ Share on other sites More sharing options...
bibby Posted February 13, 2010 Share Posted February 13, 2010 It's possible that the script is running before the form has finished closing ( /form ). IE doesn't much like appending child elements to one that's currently in the process of being written. Try moving the script after /form Link to comment https://forums.phpfreaks.com/topic/191845-ie-error-unable-to-modify-the-parent-please-help/#findComment-1011722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.