...

View Full Version : Double combo box in frames



Newfdog
07-11-2002, 09:51 PM
All,
Posted yesterday asking about Triple combo's with the last one opening in another frame. Couldn't get it to work. This time I'm trying a Double combo and needing the second box's urls to open in a different frame. Can anyone help with this?

Thank you
Newfdog


<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Technology Sites</option>
<option>News Sites</option>
<option>Search Engines</option>
</select>
<select name="stage2" size="1">
<option value="http://javascriptkit.com">JavaScript Kit</option>
<option value="http://www.news.com">News.com</option>
<option value="http://www.wired.com">Wired News</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>

<script>
<!--

/*
Double Combo Script Credit
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScripts here!
*/

var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()

group[0][0]=new Option("JavaScript Kit","http://javascriptkit.com")
group[0][1]=new Option("News.com","http://www.news.com")
group[0][2]=new Option("Wired News","http://www.wired.com")

group[1][0]=new Option("CNN","http://www.cnn.com")
group[1][1]=new Option("ABC News","http://www.abcnews.com")

group[2][0]=new Option("Hotbot","http://www.hotbot.com")
group[2][1]=new Option("Infoseek","http://www.infoseek.com")
group[2][2]=new Option("Excite","http://www.excite.com")
group[2][3]=new Option("Lycos","http://www.lycos.com")

var temp=document.doublecombo.stage2

function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}

function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>

</form>

jkd
07-11-2002, 09:53 PM
Change:

function go(){
location=temp.options[temp.selectedIndex].value
}

To:

function go(){
top.FRAMENAME.location.href=temp.options[temp.selectedIndex].value
}

Newfdog
07-11-2002, 10:11 PM
OK I'm an idiot... I posted the wrong script. This is the one I need the second combo to open in different frame. I'm guessing I need to change the function redirect, but not sure how. Sorry and thanks for your help.

Newfdog

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Business Document Menu</title>
</head>

<body>
<FORM name="isc">
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr align="center">
<td nowrap height="11" width="781">
<p align="center"> &nbsp;

<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>Select Department........</option>
<option>Manufacturing Technologies</option>
<option>Operations</option>
<option>Materials</option>
<option>Quality</option>
<option>Customer Acceptance</option>
<option>Install</option>
</select>

<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected></option>
<option value=" " selected>-----------------</option>
<option value=" " selected>-----------------</option>

</select>

<script>
<!--

/*
Triple Combo Script Credit
By Hamid Cheheltani/ JavaScript Kit (http://www.javascriptkit.com)
Visit http://javascriptkit.com for this and over 400+ other scripts
*/

var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()

group[0][0]=new Option("-----------------"," ");

group[1][0]=new Option("Now Select Group"," ");
group[1][1]=new Option("Engineering Services","engineering_services.htm");
group[1][2]=new Option("Design Engineering","46");
group[1][3]=new Option("Customer/Supplier Engineering","45");
group[1][4]=new Option("Seal Team","45")

group[2][0]=new Option("Now Select Group"," ");
group[2][1]=new Option("IS/Optics Assembly","115");
group[2][2]=new Option("IS Boards","116");
group[2][3]=new Option("Optics Alignment","116");
group[2][4]=new Option("Final Integration","116");

group[3][0]=new Option("Now Select Group"," ");
group[3][1]=new Option("ISRIP & Boards","115");
group[3][2]=new Option("Master Schedule & FI/Optics","116");
group[3][3]=new Option("Production & NPI","116");

group[4][0]=new Option("Now Select Group"," ");
group[4][1]=new Option("Quality","115");

group[5][0]=new Option("Now Select Group"," ");
group[5][1]=new Option("Acceptance","115");

group[6][0]=new Option("Now Select Group"," ");
group[6][1]=new Option("Install","115");

var temp=document.isc.stage2


function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
}


//-->
</script>

</p>

</td>
</tr>
</table>
</center>
</div>
</FORM>

jkd
07-12-2002, 12:32 AM
Replace:

<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">

With:

<select name="stage2" size="1" onChange="top.FRAMENAME.location.href = this.options[this.selectedIndex].value">

:)

Newfdog
07-12-2002, 01:39 AM
thanks jkd....

my hero:thumbsup:
Newfdog



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum