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
> how i can execute javascript in innerHTML?can anyone help?
Wrong group dude. This is php, you wanted javascript. Better luck next time.
"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
I was post same topic in javascript group also. but PHP people also
known javascript. and I have this kind of issue in AJAX. so i post
this topic at here.
Problem is the browser can't be counted on to evaluate your embedded
scripts. Here's a workaround:
http://kratcode.wordpress.com/2006/03/07/javascript-script-execution-in-innerhtml-the-revenge/
And the people who know javascript frequent the javascript newsgroups, also.
Please use the appropriate newsgroup. This is not it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
> I was post same topic in javascript group also. but PHP people also
> known javascript. and I have this kind of issue in AJAX. so i post
> this topic at here.
Some PHP people speak French too, but this isn't the best group to turn to
when you want something translated for you.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 3 days, 12:31.]
A New Look for TobyInkster.co.uk
http://tobyinkster.co.uk/blog/2007/06/22/new-look/