Help required modifying Doublecombo script

S

skinnybloke

Hi - I have been trying to modify the "Doublecombo" script which I
downloaded from Javascript kit -

http://www.javascriptkit.com/script/cut183.shtml

I want to have it visible on all the pages of my website for
navigation. On going to the target page I want the choice made on the
fist dropdown box on the first page to be displayed in the first
dropdown box on the secongd page and it's associated choices to be
displayed in the second dropdown box.

I can achieve the first part by using a cookie. I am having trouble
though displaying the choices available in the second dropdown box.

This is my modified code:

<form name="doublecombo">
<p>
<select name="brandlist"
onChange="redirect(this.options.selectedIndex)">
<option value="Aigle">Aigle</option>
<option value="Armor-Lux">Armor-Lux</option>
<option value="Bill Brown">Bill Brown</option>
</select>
<select name="stage2" size="1">
<option value="page1.html">Womens Clothing</option>
<option value="page1.html">Mens Clothing</option>
</select>
<input type="button" value="search" onClick="write_brand()">
</p>

<script language="JavaScript">
<!--
var groups=document.doublecombo.brandlist.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group=new Array()

group[0][0]=new Option("Aigle 1","page1.html")
group[0][1]=new Option("Aigle 2","page1.html")
group[0][2]=new Option("Aigle 3","page1.html")

group[1][0]=new Option("armor lux 1","page1.html")
group[1][1]=new Option("armor lux 2","page1.html")

group[2][0]=new Option("bill brown 1","page1.html")
group[2][1]=new Option("bill brown 2","page1.html")
group[2][2]=new Option("bill brown 3","page1.html")
group[2][3]=new Option("bill brown 4","page1.html")

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=new Option(group[x].text,group[x].value)
}
temp.options[0].selected=true
}
//-->
</script>
</form>
<SCRIPT language="JavaScript">
<!--
if (get_cookie("cookiebrand")!=""){
document.doublecombo.brandlist.value = get_cookie("cookiebrand")
}
function write_brand() {
var wcookiebrand=document.doublecombo.brandlist.value;
//var wcookiecategory=document.doublecombo.stage2.value;
setCookie("cookiebrand", wcookiebrand, null, "/");
//setCookie("cookiecategory", wcookiecategory, null, "/");
location=temp.options[temp.selectedIndex].value
}
//-->
</script>

If any one can help, or point me in the right direction, I would be
truly appreciative.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top