Javascript examples for DOM HTML Element:Link
Link href Property - Change style sheet:
<!DOCTYPE html> <html> <head> <link id="myLink" rel="stylesheet" type="text/css" href="http://java2s.com/style/bootstrap.min.css"> </head>/*w w w. j av a 2 s. c o m*/ <body> <h1>I am formatted with a linked style sheet</h1> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myLink").href = "style2.css"; } </script> </body> </html>