D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
roachhd
Full window
Github gist
Persistent stylesheet switcher
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "https://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>style changer button</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link id="mystyle" rel="stylesheet" type="text/css" href="style1.css"> <script type="text/javascript"> var obj0,obj1,styleid; window.onload=function() { obj0=document.getElementById('mybutton'); obj1=document.getElementById('mystyle'); readCookie(); obj0.onclick=function() { stylech(); } } function stylech() { if(obj0.value=='font-size:10px') { obj0.value='font-size:36px'; styleid='style1.css'; obj1.href=styleid; } else { obj0.value='font-size:10px'; styleid='style2.css'; obj1.href=styleid; } setCookie(); } function setCookie() { exp=new Date(); plusMonth=exp.getTime()+(31*24*60*60*1000); exp.setTime(plusMonth); document.cookie='style='+styleid+';expires='+exp.toGMTString(); } function readCookie() { if(document.cookie) { which=document.cookie.split('style=')[1]; obj1.href=which; if(which=='style1.css'){ obj0.value='font-size:36px'; } else{ obj0.value='font-size:10px'; } } else { stylech(); } } </script> </head> <body> <div><input id="mybutton" type="button" value="font-size:10px"></div> <ul> <li><a href="anotherPage.html">another page</a></li> </ul> <h1 id="test">this is a font size test</h1> </body> </html>