PDA

View Full Version : Help with target URL



annexw
02-14-2014, 06:50 PM
1) Script Title:
Chained Select Menu
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/chainedmenu/chainedmenu.html
Chained Select Menu
3) Describe problem:

I have the chained menu working here:

http://staging.thecampushub.com/redesign36/Outerweb/o_ink.asp

but I would like to the prices to appear in the iframe I have made (myiframe) not in a pop-up window. I have followed the advice here : http://www.dynamicdrive.com/forums/showthread.php?507-Chained-Select-Menu-URL-target

But its still appearing as a popup. Any help woudl be appreciated!


// Chained Menu

// Copyright Xin Yang 2004
// Web Site: www.yxScripts.com
// EMail: m_yangxin@hotmail.com
// Last Updated: 2004-08-23

// This script is free as long as the copyright notice remains intact.

var _disable_empty_list=false;
var _hide_empty_list=false;

// ------

///// 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
document.getElementById("myiframe").src=selectedOptionvalue
break
}
}
}
}
///// END DynamicDrive.com added function//////


<body onLoad="initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, 'savestate')">
<p>Ink ReFill Lookup </p>
<p>&nbsp;</p>
<form name="listmenu0">
<table width="702" align="center"><tr>
<td width="212"><select name="firstlevel" style="width:180px;"></select></td>
<td width="189"><select name="secondlevel" style="width:160px;"></select></td>
<td width="161"><select name="thirdlevel" style="width:160px;"></select></td>

<td width="120"><input type="button" value="Go" onClick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">
<input type="button" value="Reset" onClick="resetListGroup('chainedmenu')">
</tr></table>
<iframe id="myiframe" src="../ink.html"></iframe>
</form>



//var hide_empty_list=true; //uncomment this line to hide empty selection lists
var disable_empty_list=true; //uncomment this line to disable empty selection lists

var onclickaction="alert" //set to "alert" or "goto". Former is for debugging purposes, to tell you the value of the final selected list that will be used as the destination URL. Set to "goto" when below configuration is all set up as desired.

var newwindow=0 //Open links in new window or not? 1=yes, 0=no.

/////DEFINE YOUR MENU LISTS and ITEMS below/////////////////

vwphillips
02-15-2014, 11:51 AM
in the config




var newwindow='myiframe' //Open links in new window or not? 1=yes, 0=no, string = iframe.


modified function


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 (document.getElementById(newwindow)){
document.getElementById(newwindow).src=selectedOptionvalue;
}
else if (newwindow==1)
window.open(selectedOptionvalue)
else
window.location=selectedOptionvalue
break
}
}
}
}


html


<form name="listmenu0">
<table align="center"><tr>
<td><select name="firstlevel" style="width:180px;"></select></td>
<td><select name="secondlevel" style="width:160px;"></select></td>
<td><select name="thirdlevel" style="width:160px;"></select></td>
<td><input type="button" value="Go" onclick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">
<input type="button" value="Reset" onclick="resetListGroup('chainedmenu')">
</tr></table>
</form>
<iframe id="myiframe" ></iframe>

annexw
02-18-2014, 05:46 PM
Thanks! I'll give it a try today!

annexw
02-18-2014, 07:08 PM
I was able to try that code and it works if the end of the menu is a URL, which makes sense as that's how the sample is setup.

Is there any way this code could display text instead of a URL? Such as in sample.html, instead of going to cnet.com the iframe just displays the text "cnet.com"?

Thanks for your help!