HighDots Forums  

How 2 insert Javascript through innerhtml?

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss How 2 insert Javascript through innerhtml? in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tochiro
 
Posts: n/a

Default How 2 insert Javascript through innerhtml? - 12-02-2007 , 07:28 AM






Hello,

I insert a block of html in a web page through the innerhtml method.
This block of html contains a javascript function that lies in an
external javascript file referenced in the head tag of the web page.

The problem is that this function does not work. I cannot find why.

Can you help me? Thank you.

Reply With Quote
  #2  
Old   
wilson
 
Posts: n/a

Default Re: How 2 insert Javascript through innerhtml? - 12-20-2007 , 02:19 PM






On Dec 2, 8:28 am, tochiro <nos... (AT) nospam (DOT) com> wrote:
Quote:
Hello,

I insert a block of html in a web page through the innerhtml method.
This block of html contains a javascript function that lies in an
external javascript file referenced in the head tag of the web page.

The problem is that this function does not work. I cannot find why.

Can you help me? Thank you.
I'm struggling with this is well. Did you come up with a solution
yet? Thanks! Wilson


Reply With Quote
  #3  
Old   
My Pet Programmer
 
Posts: n/a

Default Re: How 2 insert Javascript through innerhtml? - 12-22-2007 , 06:48 AM



wilson said:
Quote:
On Dec 2, 8:28 am, tochiro <nos... (AT) nospam (DOT) com> wrote:
Hello,

I insert a block of html in a web page through the innerhtml method.
This block of html contains a javascript function that lies in an
external javascript file referenced in the head tag of the web page.

The problem is that this function does not work. I cannot find why.

Can you help me? Thank you.

I'm struggling with this is well. Did you come up with a solution
yet? Thanks! Wilson
If you have this:

document.getElementById('divID').innerHTML = "<script type = .......";

Then you're not going to get it to work in most browsers. Usually I end
up inserting it into an element via document.write, and you have to
split the strings up so the browsers will even let you do it. But that's
hacky and kinda silly anyway, with the way the dom works.

Maybe you could post a code snippet, so I can give you a little bit more
help than just guessing?

All the best,
~A!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.