• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Working with Forms, Buttons,... > Resetting Button Captions

Resetting Button Captions

You also can change button captions on-the-fly, using a button’s value property. Here’s an example where I change the caption of a button from Click Me! to Clicked! when the user clicks a button:

(Listing 12-11.html on the web site)

<HTML> 
    <HEAD> 
        <TITLE> 
            Changing a Button's Caption 
        </TITLE> 
        <SCRIPT LANGUAGE="JavaScript"> 
            <!--
            function clicker()
					{
					document.form1.button1.value = "Clicked!"
					} 
            // --> 
        </SCRIPT> 
    </HEAD> 

    <BODY> 
        <H1>Changing a Button's Caption</H1> 
        <FORM NAME="form1"> 
            <INPUT TYPE="BUTTON" NAME="button1" ONCLICK="clicker()" VALUE="Click Me!"> 
        </FORM> 
    </BODY> 
</HTML> 

					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint