You are here: Re: innerHTML Javascript Issues. can anyone help? « PHP Programming Language « IT news, forums, messages
Re: innerHTML Javascript Issues. can anyone help?

Posted by petersprc on 06/20/07 10:39

It would be easier to separate the text and the script and call eval
on the script part.

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/

On Jun 20, 2:10 am, Pratik Patel <anay.pra...@gmail.com> wrote:
> 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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация