Javascript examples for DOM HTML Element:Link
The Link object represents an HTML <link> element.
You can access a <link> element by using getElementById():
<!DOCTYPE html> <html> <head> <link id="myLink" rel="stylesheet" type="text/css" href="http://java2s.com/style/bootstrap.min.css"> </head>/*from w ww. j av a 2s .c om*/ <body> <h1>I am formatted with a linked style sheet</h1> <button onclick="myFunction()">get the URL of the linked document</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myLink").href; document.getElementById("demo").innerHTML = x; } </script> </body> </html>