Sunday, 15 June 2014

JavaScript access DOM element and run JavaScript within that element -


I'm trying to complete the following.

I have this type of element:

   

I want to change the type of element to "text / javascript" and then execute the code inside the script.

For example:

  & lt; Script type = "text / javascript" & gt; Var el = document.getElementById ("1"); El.setAttribute ("Type", "Text / JavaScript"); ... if some prepaid ..... LT; / Script & gt; Execute the code within L.  

Can this be done? Take a look at eval (), it should be able to do the work you want.


No comments:

Post a Comment