PDA

View Full Version : Chained Select Menu URL target



chinchilla2
10-25-2004, 07:58 PM
Chained Select Menu - DD/Xin Yang script - Dealing with the DD added section
http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm
Unfortunately, I don't have a working page of this since, well, I can't get it to work the way I want it to.

I seem to be having a bit of a problem getting the script to direct the "end selection" to an iframe located in the page the drop downs are on. The part of the config.js script that allows for new or same window target is set to the same window.

-- config.js excerpt --
var newwindow=0 //Open links in new window or not? 1=yes, 0=no.
(default setting)

I've tried several changes to the chainedmenu.js script dealing with the "end selection" area but so far, no luck at all.

-- chainedmenu.js excerpt dealing with URL direction --

///// DynamicDrive.com added function/////////////

var onclickaction="alert"

function goListGroup(){
for (i=arguments.length-1;i>=0; i--){
if (arguments[i].selectedIndex!=-1){
var selectedOptionvalue=arguments[i].options[arguments[i].selectedIndex].value
if (selectedOptionvalue!=""){
if (onclickaction=="alert")
alert(selectedOptionvalue)
else if (newwindow==1)
window.open(selectedOptionvalue)
else
window.location=selectedOptionvalue
break
}
}
}
}

///// END DynamicDrive.com added function//////

The above excerpt is as is from the zip file located here at DD. I've changed it to "goto" where needed in the script(s) when I test my changes, but I'm not getting anywhere so I've reset it to the defaults.

I'm thinking the part that needs modifying is in blue, but I could be wrong.

I know this is just a case of overthinking the problem, but could someone please take a look at it and see what it is I need to change here? The Iframe I'm targeting is called "description".

ddadmin
10-27-2004, 02:23 AM
Ok, try changing:


window.location=selectedOptionvalue
to:

document.getElementById("myiframe").src=selectedOptionvalue
with "myframe" being the ID of the iframe in question, for example:

<iframe id="myiframe" src="...></iframe>

chinchilla2
10-28-2004, 02:44 AM
As the guys on the "Guinness Stout" commercials say "BRILLIANT!"

Thank you so very much.