<INPUT type="button" value="Click Me" name="button1">
This will place a button on your page, but if you click on it nothing will happen....
Here is what all this means:
This creates a form so we can use a button.
This tag allows us to create an input area of some kind.
This command declares our input area to be a button.
4. value="Click Me"
This will be the text people will see on the button. Write whatever you want your visitors to see.
You can give the button a name for future reference and possibly for use in a script.
Just place this command inside the INPUT tag you created the button with, like this:
<INPUT type="button" value="Click Me" name="button1" onClick=" ">
Now, if you read the last section, you saw how to add text to the status bar using the onMouseover command. Well, you can also use a button to do this!
<INPUT type="button" value="See Some Text" name="button2" onClick="window.status='You clicked the button!'; return true">
Now click the button below and see the text in the status bar at the bottom:
You can also allow your viewers to change the background color of your page. Just use the following command, rather than the window.status command:
Just insert this as your instructions for the onClick command, like this:
<INPUT type="button" value="Change to Yellow!" name="button3" onClick="document.bgColor='yellow'">
Now you get the button below. Click on it to see this page with a yellow background!
You can add as many of these buttons as you like, just be sure they have the option to change back to the original color. The next script will give you three choices: yellow, red, and original color.
<INPUT type="button" value="Change to Yellow!" name="button3" onClick="document.bgColor='yellow'"> <br>
<INPUT type="button" value="Change to Red!" name="button4" onClick="document.bgColor='red'"> <br>
<INPUT type="button" value="Change back!" name="button5" onClick="document.bgColor='white'"> </FORM>
Now you will have these buttons. Give them a try!
The last script we will do in this section will allow you to use your button as a link. It's pretty fun to use every now and then. Just use the following command in your onClick command:
Here is a script that will send you to a page I made just for this example:
<INPUT type="button" value="Go to my other Page!" name="button6" onClick="window.location='http://www.pageresource.com/jscript/newpage.htm'">
Here is the button. Give it a try, and see the other page.
That does it for now, let's go on to History Buttons.
||By: John Pollock||