Link to home
Start Free TrialLog in
Avatar of boofulls
boofulls

asked on

onmouseon and target

i use this code which has images in the left frame that change to one image when the mouse is over them and to another image when they are clicked

(each option has 3 images)

but when i try to add in target=_top
into
 
<A HREF="Javascript:void(doClick(2))" onMouseOver="doOver(2); return true" onMou
seOut="doOut(2)">
<IMG SRC="../FRENCH.jpg" BORDER="0"></A>      


like this

<A HREF="Javascript:void(doClick(2))" onMouseOver="doOver(2); return true" onMou
seOut="doOut(2)" target=_top>
<IMG SRC="../FRENCH.jpg" BORDER="0"></A>      


then the page wont load up...

any ideas?
thanks





------------------
<HTML>
<HEAD>



<SCRIPT LANGUAGE="Javascript"><!--
var IMAGE_COUNT=3;
var SelectedImage=-1;

var srcsOut = new Array(IMAGE_COUNT);
var srcsOver = new Array(IMAGE_COUNT);
var srcsClick = new Array(IMAGE_COUNT);
var urls = new Array(IMAGE_COUNT);

srcsOut[0] = "../MAIN.jpg";
srcsOut[1] = "../REG.jpg";
srcsOut[2]= "../FRENCH.jpg";            


srcsOver[0] = "../MAINON.jpg";
srcsOver[1] = "../REGON.jpg";
srcsOver[2] = "../FRENCHON.jpg";  


srcsClick[0] = "../MAINB.jpg";
srcsClick[1] = "../REGB.jpg";
srcsClick[2] = "../FRENCHB.jpg";        


urls[0]="main.html";
urls[1]="http://me/cgi-bin/test.cgi";
urls[2]="protected_dir/index.html";  


function doOver(which){
if(SelectedImage!=which)document.images[which].src=
srcsOver[which];
}

function doOut(which){
if(SelectedImage!=which)document.images[which].src=
srcsOut[which];
}

function doClick(which){
if(SelectedImage!=-1)document.images[SelectedImage].src=
srcsOut[SelectedImage];
document.images[which].src=srcsClick[which];
SelectedImage=which;
top.window.main.location=urls[which];
}
//--></SCRIPT>

</HEAD>                                

<BODY BGCOLOR=FFFFFF TEXT=000000 LINK=0000FF VLINK=800080>
<br>
<A HREF="Javascript:void(doClick(0))"onMouseOver="doOver(0); return true" onMous
eOut="doOut(0)">
<IMG SRC="../MAIN.jpg" BORDER="0"></A>
<A HREF="Javascript:void(doClick(1))"onMouseOver="doOver(1); return true" onMous
eOut="doOut(1)">
<IMG SRC="../REG.jpg" BORDER="0"></A>
<A HREF="Javascript:void(doClick(2))" onMouseOver="doOver(2); return true" onMou
seOut="doOut(2)">
<IMG SRC="../FRENCH.jpg" BORDER="0"></A>      



</BODY>
</HTML>

--------------------
                                 
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of boofulls
boofulls

ASKER

but what if i want some to target _top and others to target "main"

ie
if image one and two are to be
target=_top
and image three is to be
target="main"

thanks
i did a doclick2 function and changed the code as u mentioned
thanks
function doClick(whichImage,where) {
   eval(where+'.location=urls['+whichImage+']');
}

..
..


<A HREF="javascript:;" onCLick="doClick(0,'main')"
onMouseOver="doOver(0); return true"
onMouseOut="doOut(0)"><IMG SRC="../MAIN.jpg" BORDER="0"></A>
<A HREF="javascript:;" onCLick="doClick(1,'top')"
onMouseOver="doOver(1); return true"
onMouseOut="doOut(1)"><IMG SRC="../MAIN.jpg" BORDER="0"></A>