Working with parameters in the URL from javascript

Task is to hide some page elements based on parameter in the URL. Example URL: http://mypage.com?hidePrintButton=true In this case we should hide print button. Implementation (without jQuery): <script language='JavaScript'> window.onload = function() { if(document.URL.indexOf('hidePrintButton=true')!==-1){ document.getElementById('printButton').style.visibility='hidden'; } } </script> <button id="printButton" class="link icon iconPrint notPrintable pagePrint" title="Do print page" type="button"></button>  

Leave a Reply

Your email address will not be published. Required fields are marked *




Enter Captcha Here :