mpalmer12345
Programmer
Rollover with a twist.
I am trying to do the basic rollover image idea, but with the twist that if you click on the mouse, the images are swapped. So if rollover with image 1 as base, image 1 -> image 2; if click then rollover, image 2 -> image 1. Also the reverse: if rollover with image 2 as base, image 2 -> image 1; if click then rollover, image 1 -> image 2.
Here's the code I got so far, which works except for the image swap.
<HTML><HEAD>
<SCRIPT language="JavaScript">
var bin01 = 0;
if (document.images) {
var Inside01 = new Image();
var Outside01 = new Image();
Inside01.src = "Inside01x.jpg";
Outside01.src = "Outside01x.jpg";
}
function binswitch(bin01) {
bin01 = (bin01 + 1) % 2;
}
function act11(imgName) {
if (bin01 == 0) {
if (document.images) {
document.images.advan0.src = eval(imgName + ".src");
}
}
if (bin01 == 1) {
if (document.images) {
document.images.advan1.src = eval(imgName + ".src");
}
}
}
</SCRIPT>
<title>Inside | Outside 01 2004 / (c) mwp</title>
</HEAD>
<BODY bgcolor="#EFFFFF">
<div align="center"> <a href="" onmouseover="act11('Inside01')" onMouseOut="act11('Outside01')" onClick="binswitch('bin01')";>
<IMG SRC="Outside01x.jpg" NAME="advan0" BORDER="0"></a> </div>
</HTML>
I am trying to do the basic rollover image idea, but with the twist that if you click on the mouse, the images are swapped. So if rollover with image 1 as base, image 1 -> image 2; if click then rollover, image 2 -> image 1. Also the reverse: if rollover with image 2 as base, image 2 -> image 1; if click then rollover, image 1 -> image 2.
Here's the code I got so far, which works except for the image swap.
<HTML><HEAD>
<SCRIPT language="JavaScript">
var bin01 = 0;
if (document.images) {
var Inside01 = new Image();
var Outside01 = new Image();
Inside01.src = "Inside01x.jpg";
Outside01.src = "Outside01x.jpg";
}
function binswitch(bin01) {
bin01 = (bin01 + 1) % 2;
}
function act11(imgName) {
if (bin01 == 0) {
if (document.images) {
document.images.advan0.src = eval(imgName + ".src");
}
}
if (bin01 == 1) {
if (document.images) {
document.images.advan1.src = eval(imgName + ".src");
}
}
}
</SCRIPT>
<title>Inside | Outside 01 2004 / (c) mwp</title>
</HEAD>
<BODY bgcolor="#EFFFFF">
<div align="center"> <a href="" onmouseover="act11('Inside01')" onMouseOut="act11('Outside01')" onClick="binswitch('bin01')";>
<IMG SRC="Outside01x.jpg" NAME="advan0" BORDER="0"></a> </div>
</HTML>