JS Playground


Scriptswitcher in action

Maybe I was not able to clearly explain what I mean in my last post about scriptswitcher. Last few days I worked on new website, where you can check real example of this scriptswitcher method. Site is here Kongresové služby, scriptswicher is in left column under menu.
Due to comment in previous post I change code little bit. Switcher was not very friendly. But I am not php coder, so there may be something wrong. Here it is:

<?php session_start();
setcookie("scriptsrc", $js_name, time()+(60*60*24*30), "/", ".kongresove-sluzby.cz");
<script type="text/javascript" src="<?php echo $js_name?>.js"></script>
<form action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="get">
<fieldset id="switcher">
<legend>Javascript switcher</legend>
<input type="hidden" class="hide" name="scriptsrc" <?php if($js_name=="scriptloader"){echo" value=\"none\"";}else{echo" value=\"scriptloader\"";}?> />
<input type="submit"<?php if($js_name=="scriptloader"){echo" value=\"Switch off javascript\"";}else{echo" value=\"Switch on javascript\"";}?> />