| Posted by Pratik Patel on 06/20/07 06:10 
Hello,
 I used innerHTML to assign HTML content. but in my HTML page content
 have also some javascript function and it will run when page load. bu
 when HTML code assgin thru innerHTML then this javascript is not
 working.
 
 e.g.
 
 html content:
 ......................
 <html>
 <body>
 <table>
 <tr><td>
 Some content here.
 </td></tr>
 </table>
 <script language="javascript">
 alert("hi");
 </script>
 </body>
 </html>
 
 I am assign this html page in innerHTML content
 
 document.getElementById('div1').innerHTML="<html><body><table><tr><td>Some
 content here.</td></tr></table><script
 language="javascript">alert("hi");</script></body></html>";
 
 when i used direct html page it's given alert message. but when i used
 theu innerHTML then it's not given alert message.
 
 how i can execute javascript in innerHTML?can anyone help?
 
 Regards
 Pratik Patel
  Navigation: [Reply to this message] |