Javascript examples for DOM HTML Element:Script
The Script object represents an HTML <script> element.
You can access a <script> element by using getElementById():
<!DOCTYPE html> <html> <body> <script id="myScript" src="src.js"></script> <button onclick="myFunction()">get the URL of the external script file</button> <p id="demo"></p> <script> function myFunction() {//from www .ja v a 2 s.c o m var x = document.getElementById("myScript").src; document.getElementById("demo").innerHTML = x; } </script> </body> </html>