Hi there,
I have been given some code to use to toggle between enabling and disabling of Cascading Stylesheets. The only problem is that the code has been given to me to be used as is in a webpage link (see below):
[code=php]<a href=”javascript:var i=0;if(document.styleSheets.length>0){cs=!document.styleSheets[0].disabled;for(i=0;i<document.styleSheets.length;i++) document.styleSheets[i].disabled=cs;};void(cs=false);”>Toggle CSS</a>
Can someone tell me if this code can be used by including it in a global js file that I can call? If so how would I do that and is there a way in incorporate an alert box if js is disabled?
Many many thanks
Karl