capt webb
Capt. Horatio T.P. Webb
VBScript MouseOvers
Parks -- FALL 1999

Last Updated 10:00 AM 10/26/99

 
First the two images for the rollover. Here are the two button images:
 
buttonup.gif 32 pixels wide and 20 pixels tall
buttondwn.gif 32 pixels wide and 20 pixels tall
 
Now the "live" rollover image:
 
 
Don't like red or green, just edit the red and green colors in the two images to alter the button appearance. Note -- on a white background, the white bevels (upper and left side) of the buttonup.gif image are not contrasted well against the white background.

Here is the VBScript code:

sub swp(mouse_action) 
  select case mouse_action
    case "down"
        document.images(3).src="buttondwn.gif"
    case "up"
        document.images(3).src="buttonup.gif"
    case "click"
        msgbox "You clicked the button!"
  end select  
end sub

and the code in the HTML for the "live" button:

<a name="stayhere">
<a href="" onMouseOver="swp('down')" onMouseOut="swp('up')" onClick="swp('click')">
<img src="buttonup.gif" border="0"></a>

Note -- you could use on MouseDown instead of onClick.
Note -- the "stayhere" is not required. It is used to keep the page from changing during the demo.