JavaScript & "Buttons"

Alert

<FORM>
     <INPUT TYPE="Button" VALUE="Alert"
  
    onClick="alert('this is the message')">
</
FORM>

Link Button

To create a Button on your page simply insert this code in to the body of your document and change the "link location" and "Button description"

<FORM>
     <INPUT TYPE="Button" VALUE="DESCRIPTION"
  
    onClick="location.href='LINK'">
</
FORM>

Back and Forward Buttons

<FORM>
     <INPUT TYPE="Button" VALUE=" << "
  
    onClick="history.go(-1)">
     <INPUT TYPE="Button" VALUE=" >> "
  
    onClick="history.go(1)">
</
FORM>

Back And Forward Image Button

  

Here you can make use of the back and forward functions with pictures. All you need to do is copy this 2 lines. Just change the uppercase text.

<A HREF=""
 
onClick="parent.history.back();"
 
onMouseOver="self.status='Back'; return true;"
 
onMouseOut="self.status='';">
<IMG SRC="YOU PICTURE" BORDER="0">
</A>

<A HREF=""
 
onClick="parent.history.forward();"
 
onMouseOver="self.status='Forward'; return true;"
 
onMouseOut="self.status='';">
<IMG SRC="YOU PICTURE" BORDER="0">
</A>

Back And Forward Buttons - Frames

Here's any easy way to use the back and forward buttons in frames. These buttons have to go into another frame other than the main frame, they won't work without frames! A working example is down in the lower left hand corner. Just copy this code and change FRAME TARGET NAME to the name of the frame that you want to go back and forward.

<FORM>
     <INPUT TYPE="button" VALUE="BACK"
  
    onClick="parent.FRAME TARGET NAME.history.back()">
     <INPUT TYPE="button" VALUE="FORWARD"
  
    onClick="parent.FRAME TARGET NAME.history.forward()">
</
FORM>

View Source Button

Fill in the ALL "CAPS WORDS" in quotes that work on your page Frame name Generally Main.

<FORM>
     <INPUT TYPE="Button" VALUE="View Source"
   
    onClick= 'location = "view-source:" + location'>
</
FORM>

View Source Button - Frames

(This will view the menu on the left side.)

Here's the code, all you need to do is to change the FRAME TARGET NAME.

<FORM>
     <INPUT TYPE="BUTTON" VALUE="View Source"
  
    onClick= 'parent.FRAME TARGET NAME.location =
       "view-source:" + parent.FRAME TARGET NAME.location
'>
</
FORM>

Reload Button

<FORM>
     <
INPUT TYPE="BUTTON" VALUE="Reload"
  
    onClick="location.reload()">
</
FORM>

Reload Button- Frames

(This will only reload the counter in the bottom left.)

Just copy this line and change the FRAME TARGET NAME.

<FORM>
     <
INPUT TYPE="BUTTON" VALUE="Reload"
  
    onClick='parent.counter.location="javascript:location.reload()"'>
</
FORM>

New Window

This button opens a new window where you can control its properties (scrollbars, size, status...). To do that, answer yes or no, or change the numbers. You can also make the window open to a link or a file.

<FORM>
     <
INPUT TYPE="BUTTON" VALUE="Open Window"
      
onClick="open('YOUR LINK GOES HERE', 'Sample',
       'location=yes,scrollbars=yes,width=635,height=660')
">
</
FORM>