Set default image or text in html input box
Suppose you have a user login panel which shows two input text field, one for username & another for password. Now you don’t wanna use level for this input box. Then What!!!!!!!
Simply show text or image inside input box.
Here is the code…..
<form action="#" method="post"> <input name="login_username" value="email" type="text" onfocus="if(this.value=='email') this.value='';" onblur="if(this.value=='') this.value='email';" /> <input name="login_password" value="" type="password" style="background:url(../images/password.gif);"/> <input value="GO" name="login" type="submit" /> <a href='#'>forgot password?</a> </form>
Advertisement
Categories: JavaScript, Tips & Tricks
