Bài đăng

Đang hiển thị bài đăng từ tháng 12 9, 2007

disable the F5 and Refresh button using Javascript

if (document.all){ document.onkeydown = function (){ var key_f5 = 116; // 116 = F5 if (key_f11==event.keyCode){ alert("F5 pressed"); return false; } } } function document.onKeyPress() { if(event.keyCode=116)return false; }

Get URL Parameters Using Javascript

Get URL Parameters Using Javascript function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } function getURLParam(name){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return "no"; else return results[1]; }

This is one that I use. It has no warning pop-up window. It simply prevents them from right clicking on a page.

This is one that I use. It has no warning pop-up window. It simply prevents them from right clicking on a page. Code: //Disable right click script //no alert var message=""; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") This doesn't stop anyone who knows enough, but it will frustrate the newbies!