Default value by using OnFocus event of a text box

Text OnFoucs We can trigger any function or perform any task by using onfocus event for the form elements. For example we want to show some text inside a text element when crusher enters into the text box. Here we will use onfocus event. If we are using tab to navigate between the form elements then for each elements of a form we can give some default value.

We have used here three text boxes and by using tab each elements can be accessed. For the third element ( third text box ) we have used the on focus event to trigger the JavaScript function to set the value for the text box. Here is the code
<title>(Type a title for your page here)</title>
<script type="text/javascript">
function entername()

<body >

<form name=f1 action='' method=post>
Your Userid<input type=text name=t3><br>
Your Password<input type=text name=t2><br>
Your Name<input type=text name=t1 onfocus='entername()';>



* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 All rights reserved worldwide Privacy Policy Disclaimer