Image RollOver With Click-Stick Option

[Total: 0    Average: 0/5]

This shows how to have an image act just like a roll over, but yet if the user clicks on the image, the “on” image will stick and not change back.

Body Code:

<script type=text/javascript>
// to set the total number of buttons involved 
// change the value of buttnum 
var buttnum=2; 

// initialize an array and loop through adding an element 
// for each button, initializing the element to false 
var buttons=new Array(); 
for(var i=1;i<=buttnum;i++){ 

// function to check the status of the button when clicked and 
// change the image or exit, depending on boolian value 
function switch_img(_event,img_name,img_src){ 
if(buttons[img_name]==true) return; 

<A HREF="#" 
<IMG NAME="button1" SRC="" ALT="Image1" border="0" align="right" width="85" height="22" hspace="0" vspace="0" units="pixels"></A>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *