Text.defaultValue : Text Object : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » Text Object »

 

Text.defaultValue







The defaultValue property contains the default value specified by the VALUE attribute of the tag. This property is often used to reset forms to their default values.












<html>
    <head>
    <script language="JavaScript">
    <!--
    function resetForm(){
      document.myForm.myText.value = document.myForm.myText.defaultValue;
    }
    -->
    </script>
    </head>
    <body>
    <b>Edit the text in the following text box:</b>
    <P>
    <form name="myForm">
      <input type=TEXT value="hello world" name="myText">
      <input type=BUTTON value="Click to Reset" name="myButton"
             onClick="resetForm()">
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» Text Object