...

View Full Version : Drop Down Menu Multiple Targets. Yet Another Challenge 4 U



B-pLeAsE
08-23-2002, 03:36 AM
I'm a the webmaster over at siccness.net a site I designed a couple months back. The design called for use of a drop down menu which was no sweat.. First problem I ran into was how to make the links in the drop down menu target in the I frame (Sumthing you guys solved for me)....

Now I've ran into yet another problem. Making multiple targets with one drop down menu. I want to have some links target a new window and I want some to target the I Frame and thats where you script masters come in.. CAN WE DO IT....

The Link to the site is: http://siccness.net

You'll see what I'm talking about once you see my navigation box...

Thanks yall..
B-pLeAsE

B-pLeAsE
08-24-2002, 01:27 AM
Anyone feel like taking this one on?

beetle
08-24-2002, 08:23 AM
perhaps something like this?
function doLink(opt) {
var targ = parseInt(opt.target);
var link = opt.value;
switch (targ) {
case 0 : Do whatever with 'link' here; break;
case 1 : Do whatever with 'link' here; break;
case 2 : Do whatever with 'link' here; break;
case 3 : Do whatever with 'link' here; break;
}
}

(...HTML...)

<select onChange="doLink(this.options[this.selectedIndex])">
<option value="page1.htm" target="1">link</option>
<option value="page2.htm" target="0">link</option>
<option value="page3.htm" target="1">link</option>
<option value="page4.htm" target="3">link</option>
<option value="page5.htm" target="2">link</option>
</select>

B-pLeAsE
08-24-2002, 04:04 PM
I'll give it a shot.. thanks for helping out...

B-pLeAsE
08-24-2002, 04:54 PM
I can't get it to work, I set up a Demo page maybe i'm doing sumthing wrong....:confused:

http://wckillaz.net/navigate.html

Thanks again...

beetle
08-24-2002, 09:43 PM
That's becuase you aren't doing anything in the case statement. Here, more like this...
function doLink(opt) {
var targ = parseInt(opt.target);
var link = opt.value;
switch (targ) {
case 0 : window.open(link,'_blank',''); break;
case 1 : top.frames['I1'].location.href=link; break;
}
}

B-pLeAsE
08-25-2002, 04:52 AM
It Worked!!!!

Much Thanks Man! You dont know how much this helps me out. if i wanted to make target 3 a pop up window could i make that happen or would that be too complex?

beetle
08-25-2002, 05:48 PM
You can make as many cases as you like...
function doLink(opt) {
var targ = parseInt(opt.target);
var link = opt.value;
switch (targ) {
case 0 : window.open(link,'_blank',''); break;
case 1 : top.frames['I1'].location.href=link; break;
case 2 : //code ; break;
case 3 : //code ; break;
}
}

B-pLeAsE
11-10-2002, 03:47 AM
This navigation is nice, but i was wonderin if anyone can confirm it works in netscape.. I've had a few people complain about it not working.. -->> http://wckillaz.net

B-pLeAsE
11-11-2002, 12:35 AM
bump...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum