Wednesday, October 28, 2009

Monday, October 26, 2009

Way to disable the right click mouse

With the code below, you may modify it to become code to detect the onmouseclick on the document.body and do some action after that.

 <HTML><HEAD> <script language="javascript">  function click(e) {   if (navigator.appName == 'Netscape'            && e.which == 3) {       alert("no right click please")       return false;       }    else {       if (navigator.appName == 'Microsoft Internet Explorer'           && event.button==2)          alert("no right click please")          return false;          }    return true;  } document.onmousedown=click </script> </HEAD> <BODY> No right mouse button here! </BODY></HTML>

Wednesday, October 14, 2009

JAVA SCRIPT - Convert From String to Unicode

function toUnicode(theString) {
  var unicodeString = '';
  for (var i=0; i < theString.length; i++) {
    var theUnicode = theString.charCodeAt(i).toString(16).toUpperCase();
    while (theUnicode.length < 4) {
      theUnicode = '0' + theUnicode;
    }
    theUnicode = '\\u' + theUnicode;
    unicodeString += theUnicode;
  }
  return unicodeString;
}