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="javas cript">
alert("hi");
</script>
</body>
</html>
I am assign this html page in innerHTML content
document.getEle mentById('div1' ).innerHTML="<h tml><body><tabl e><tr><td>Some
content here.</td></tr></table><script
language="javas cript">alert("h i");</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
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="javas cript">
alert("hi");
</script>
</body>
</html>
I am assign this html page in innerHTML content
document.getEle mentById('div1' ).innerHTML="<h tml><body><tabl e><tr><td>Some
content here.</td></tr></table><script
language="javas cript">alert("h i");</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
Comment