|
Background
Effect: Using buttons instead of links
The example above is functional.
Click on any button to see how it works. Just cut and paste the code below
to your page source taking note of the parameters to be changed.
<form>
<input type="button"
value="Welcome Page"
onclick="window.location.href='http://www.???.com'">
<input type="button"
value="Back" onClick="history.go(-1)">
<input type="button"
value="green" onclick="document.bgColor='green">
<input type="button"
value="blue" onclick="document.bgColor='blue'">
<input type="button"
value="white" onclick="document.bgColor='white'">
</form> |
1. The button with "Home
Page" written in it will take you to the welcome page of this site.
You can
replace that with value="Home Page" or whatever descriptive name you have
for the
destination
page. Change "http://www.???.com" with the complete URL/link of
the destination.
The above
example has "http://www.newbiehangout.com" as URL which
links
to the
Welcome Page of NewbieHangout.com.
| <input type="button"
value="Welcome Page" onclick="window.location.href='http://www.???.com'"> |
2.
You don't need to do anything on this part if you want to retain it as
a "Back" button. However, if
you wish to have a "Forward" button type value="Forward" in replace of
value="Back" and make
the -1 of "history.go(-1)" to +1.
This means that if you have accessed
another site after reading
this and returned back here using the same browser window, when you click
on the "Forward"
button you will be transported to the page you accessed after this. The
reverse goes with "Back"
which will bring you to the previously accessed page.
| <input type="button"
value="Back" onClick="history.go(-1)"> |
Note:
The "Back" button above would not work if you did not access a page prior
to this.
3. The last four buttons
with "green" "gray" and "magenta" will change the background color of this page with
green
or gray, whichever you choose to click. You can add more buttons with other
colors by
duplicating
the code below and changing "green" to your desired color.
| <input type="button"
value="green" onclick="document.bgColor='green"> |
To
learn more neat tricks and tips, visit us at.
The Newbie Hangout
It's FREE! |