Effect principle:
Prepare several sets of CSS style sheets
Tune each CSS style sheet for compatibility
When clicking the button, change the value of the href in link (JS gets the link tag, the value of the href is changed by JS, Link can also give its ID)
HTML and JS:
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Untitled Document</title><LinkID= "Link1"href= "Css1.css"rel= "stylesheet"type= "Text/css" /></Head><Body><DLID= "message"> <form> <DT> <Strong>You can change the skin of the submission box:</Strong> <inputID= "BTN1"type= "button"value= "Skin 1" /> <inputID= "BTN2"type= "button"value= "Skin 2" /> </DT> <DD>Enter your name:<inputclass= "text"type= "text" /></DD> <DD>Enter Password:<inputclass= "text"type= "Password" /></DD> <DD>Please leave your message:<textarea></textarea></DD> <DDclass= "Center"><inputclass= "BTN"type= "Submit"value= "Submit" /></DD> </form></DL></Body><Scripttype= "Text/javascript"> if(document.getElementById) {btn1=document.getElementById ("BTN1"); BTN2=document.getElementById ("btn2"); Link1=document.getElementById ("Link1"); Btn1.onclick=function() {link1.href="Css1.css"; } Btn2.onclick=function() {link1.href="Css2.css"; } }Else{alert ("Browser not compatible, please replace"); }</Script></HTML>