University of Delaware
Script for changing stylesheets:<!DOCTYPE html ><html><head> <head> <title>Changing CSS using only JavaScript</title> <link rel="stylesheet" href="zindex.css"/> <script > function swapCSSStyle(x, y) { var oldlink = document.getElementsByTagName("link").item(y); var newlink = document.createElement("link") newlink.setAttribute("rel", "stylesheet"); newlink.setAttribute("href", x); document.getElementsByTagName("head").item(y).replaceChild(newlink, oldlink); } </script> </head> <body> <p id = "blue"> blue </p> <p id = "purple" >purple </p> <p id = "green"> green </p><button onclick="swapCSSStyle('zindex.css', 0);">Style 1</button> <button onclick="swapCSSStyle('zindexalt.css', 0);">Style 2</button> </body></html>Instructions:To change the stylesheet by clicking a button:You must include the script above (from <script>… to </script> in the head section of your html page. You must have at least two styles: I called mine zindex.css and zindexalt.css. You can call yours whatever you want, but you must replace the green text with the names of your stylesheets.And you must include the two buttons in the body of your web page. These buttons call the script. (the red buttons in the html code above) ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- bp cis 2003 authoring instructions style configuration
- university of delaware
- html forms javascript and cascading style sheets
- html reference sheet
- html body background color tag with bgcolor it present
- professor kevin curran technology communicator
- digital clock school of tutorials home
- linking to a discussion point emergency management
Related searches
- bny mellon trust of delaware verify check
- bny mellon trust of delaware phone number
- state of delaware professional regulations
- state of delaware professional license lookup
- state of delaware license verification
- state of delaware certificate incorporation
- state of delaware professional regulation
- alzheimer s association of delaware valley
- state of delaware division of corporations
- state of delaware property search
- state of delaware online division of corporations
- state of delaware articles of incorporation