P
Pratik Patel
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
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