Show message in TextBox

JavaScript can be used to display some information to the users.When user click on the textbox,
message will be hidden.very simple one but can be used in HTML forms without using will
increase the look and feel of the web page.

<script language=JavaScript>

function clear_username()
if (document.text_form.u_input.value == "username")
document.text_form.u_input.value = "";

if (document.text_form.input.value =="")
document.text_form.input.value ="password";

function clear_password()
if (document.text_form.input.value == "password")
document.text_form.input.value = "";

if (document.text_form.u_input.value == "")
document.text_form.u_input.value = "username";


This a simple HTML form to and when user click the text-box on-focus event will
call my JavaScript function.

<form name="text_form" action="#" method=post>
<input name=u_input onFocus=clear_username() value="username">
<input name=input onFocus=clear_password() value="password">
<input type=submit value=Submit>
<input type=reset>

No comments:

Post a Comment