moirakris
Technical User
- Oct 11, 2002
- 82
Ok I have the following script generously provided by webteacher.com but am trying to figure out how to modify it.
You select a catagory in the first drop down, and then the second drop down changes to show the correct sub catagories. Now what I want to add is a form button that when clicked opens a url based on the name in the sub catagory chosen +.html.
Example, if they choose Advisor in the catagory then Kel in the sub catagory, when they press the Get Info button I would like it to open a file named kel.html
Here is the code
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--Begin JavaScript
function setList(f) {
secondlist=eval("'"+f.elements['main'].options[f.elements['main'].selectedIndex].text+"'"
;
f.elements['sub'].options.length=0;
size=eval("lists['"+secondlist+"'].length"
;
for(i=0;i<size;i++) {
newval=eval("lists['"+secondlist+"']"
;
f.elements['sub'].options=new Option(newval);
};
f.elements['sub'].selectedIndex=0;
};
lists=new Array();
lists['Leader'] = new Array();
lists['Leader'][0]="Dennis";
lists['Leader'][1]="Carl";
lists['Leader'][2]="Kris";
lists['Council'] = new Array();
lists['Council'][0]="Charlie";
lists['Council'][1]="David";
lists['Council'][2]="Jay";
lists['Advisors'] = new Array();
lists['Advisors'][0]="Nicole";
lists['Advisors'][1]="Kel";
lists['Advisors'][2]="Andy";
lists['Advisors'][3]="Dan";
//End JavaScript-->
</SCRIPT>
<BODY BGCOLOR=WHITE onLoad="setList(document.listsform)">
<FORM NAME="listsform">
<SELECT NAME="main" onChange="setList(form)">
<OPTION>Leader</OPTION>
<OPTION>Council</OPTION>
<OPTION>Advisors</OPTION>
</SELECT>
<SELECT NAME="sub">
<OPTION> </OPTION>
<OPTION></OPTION>
<OPTION></OPTION>
<OPTION></OPTION>
</SELECT>
</FORM>
</BODY></HTML>
Any assistance would be greatly appreciated. I am just starting to learn this and really struggling with it Moira
"Those that stop learning, stop living."
You select a catagory in the first drop down, and then the second drop down changes to show the correct sub catagories. Now what I want to add is a form button that when clicked opens a url based on the name in the sub catagory chosen +.html.
Example, if they choose Advisor in the catagory then Kel in the sub catagory, when they press the Get Info button I would like it to open a file named kel.html
Here is the code
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--Begin JavaScript
function setList(f) {
secondlist=eval("'"+f.elements['main'].options[f.elements['main'].selectedIndex].text+"'"
f.elements['sub'].options.length=0;
size=eval("lists['"+secondlist+"'].length"
for(i=0;i<size;i++) {
newval=eval("lists['"+secondlist+"']"
f.elements['sub'].options=new Option(newval);
};
f.elements['sub'].selectedIndex=0;
};
lists=new Array();
lists['Leader'] = new Array();
lists['Leader'][0]="Dennis";
lists['Leader'][1]="Carl";
lists['Leader'][2]="Kris";
lists['Council'] = new Array();
lists['Council'][0]="Charlie";
lists['Council'][1]="David";
lists['Council'][2]="Jay";
lists['Advisors'] = new Array();
lists['Advisors'][0]="Nicole";
lists['Advisors'][1]="Kel";
lists['Advisors'][2]="Andy";
lists['Advisors'][3]="Dan";
//End JavaScript-->
</SCRIPT>
<BODY BGCOLOR=WHITE onLoad="setList(document.listsform)">
<FORM NAME="listsform">
<SELECT NAME="main" onChange="setList(form)">
<OPTION>Leader</OPTION>
<OPTION>Council</OPTION>
<OPTION>Advisors</OPTION>
</SELECT>
<SELECT NAME="sub">
<OPTION> </OPTION>
<OPTION></OPTION>
<OPTION></OPTION>
<OPTION></OPTION>
</SELECT>
</FORM>
</BODY></HTML>
Any assistance would be greatly appreciated. I am just starting to learn this and really struggling with it Moira
"Those that stop learning, stop living."