Daily Archives: June 18, 2008

2 posts

[JavaScript]Clear the content of a textbox when it gets the focus

(I truly believe that a professional Web developer cannot live without JavaScript, and I have been busy playing with JavaScript lately and I will post some common but useful JavaScript code here.) Here is the JavaScript code: <script language=”javascript” type=”text/javascript”>        function clearBox(id)         {            var txt = document.getElementById(id);            if (txt.type != “text”)            {              alert(“Error: parameter type mismatch in clearBox function. TextBox type expected.”);            }            else           {                […]

Prevent browser from remembering inputted data in text box

Browser has a handy feature that remembers the information entered earlier in text boxes, and this feature can save you a lot of time when you fill up a form on-line. Sometimes, however, this feature may cause unwanted behaviors, even security concerns. For example, browser should not remember the credit card number that was entered. Another example is if you have a RegularExpressionValidator to validate a text box field, and if the text box has […]