Javascript examples for DOM HTML Element:Script
Add script content to page on runtime
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . ja va 2 s . co m*/ var script = document.createElement('script'); script.text = "var a = 1;console.log(a);" ; //to use external js then use src document.getElementsByTagName('head')[0].appendChild(script); } </script> </head> <body> </body> </html>