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>

--------------------
                                 
boofullsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Wrong place.

Target is not valid on a javascript href...

You should change the line

top.window.main.location=urls[which];

to

top.location=urls[which];

in doClick

Michel

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
boofullsAuthor Commented:
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
0
boofullsAuthor Commented:
i did a doclick2 function and changed the code as u mentioned
thanks
0
Michel PlungjanIT ExpertCommented:
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>

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.