Tag

Javascript

Javascript to disable right cilck on web site

Just come across with my company SQA team where they request us to do the disable right click features on our front end web site. The initial javascript which exists in our script only work with Microsoft Internet Explorer but not Firefox. So Google around and found the following javascript…

Form validation not allow chinese cheractor

the following example use the javascript regular express to validate the value where Chinese charecter is not allow. <script   language=javascript>           function   checkChinese(){               var   re   =   /[u4E00-u9FA0]+/;               if   (re.test(form1.tjiccode.value))…

URL Hidden Tricks to check page's last update

Check the page’s last update date Go to any web site as you like Delete the content in the URL address bar Enter the following script javascript:alert(document.lastModified) Press Enter This code will display any web page’s last update including the specific time, so by using the this script, you will…

Attaching event in both MSIE and FF with Javascript

Most of the developer who working in MS platform will be used to the javascript window.attachEvent. But maybe some of you don’t know that window.attachEvent is only working on IE7+ and Opera only. Your coding will hit an javascrpit error when running at IE 6 or any version of firefox.…

Disabled certain key to be entered using javascript

There is always the good way to prevent and verify the using enter data, especially for each text box or text area. The following is script use the event object to check on the key code that the user enter, return false to prevent user to enter. Disabled space to…

Trim a string in Javascript

Trim is a good features when you try to delete the space at the left most, right most or both the left most and right most of the string. The following trim function is ultilize the javascript Regular expression for the trim function Left Trim function ltrim(str){     return str.replace(/^s+/, ”);…