|
|
Buttons List of Categories
- How do I create a simple back button?
- How do I create a simple forward button?
- How do I send the user futher back or forward?
- How do I call or execute a function using a button?
- How does a button differ from a submit button?
-
How do I create a simple back button?
Back buttons send the user to the last page recorded in the history list. This acts just like the browser's back button.
<form>
<input type="Button" value="Back" onclick="history.back()">
</form>
-
How do I create a simple forward button?
The same way you would create a back button, except you use the forward method.
<form>
<input type="Button" value="Forward" onclick="history.forward()">
</form>
The button above is the equivalent of pressing the browser's forward button.
-
How do I send the user futher back or forward?
By using the go() method. To navigate further back or forward, enter the number of pages between the paranthesis. Use a "minus" sign to move back, use any number (without a minus sign) to move forward that number of pages.
<form>
<input type="Button" value="Back" onclick="history.go(-2)">
</form>
-
How do I call or execute a function using a button?
First you write your function. Then you execute it using an event handler such as onClick or onMouseover. Let's say you have a function named "calculate()" and you want that function executed when a user clicks your button. You could achieve this using :
<form>
<input type="Button" value="Get Total" onclick="calculate()">
</form>
-
How does a button differ from a submit button?
You define a button type using the type attribute of an input tag. If you specify that it should be a button, as in <input type="Button">, the button then needs some functionality attached to it. Whereas if you specify that it should be a Submit button, as in <input type="Submit">, it will submit the form it resides within, when clicked. The URL in the form's actions is then called by the browser, which is similar to a hyper link excpet you can also tell the browser how to send the information to the server.
|
|
|