iwel's e-notes about his World
Javascript
Tips:Making input box non-editable
Jun 17th
This is sunday.. and im sitting in my chair at my office… darn.. Get A life dudeee… *life of a coder
one of my friend ask me how to make a visible but no-editable text box on a form. Everything is easy when u know d basic of javascript,
Lets cut d crap.. the basic logic is to throw away d focus of cursor when the control has d cursor in it.We only use one event to throw d focus and that is,the blur event.
Try to put ur cursor on this textbox, i havent test this on many browser, currently i use firefox 2.0 to run this script :
The code for it :
<input name=”text1″ type=”text” value=”password” size=”25″ maxlength=”25″ onfocus=”this.blur();” />