jumpmaster82
IS-IT--Management
I'm trying to learn java by looking at existing scripts, and I am trying to get this peice of a script to open in a new window. It is a combo box menu which, when selected, will open the linked URL. I'm using the menu in a frame page so when I open it I want a new window.
Here is the script
<form name="dynamiccombo" target="_blank">
<select name="stage2" size="1" onChange="displaysub()">
<option value="#">This is a place Holder text </option>
<option value="#">This is a Place Holder text </option>
<option value="#">This is a Place Holder text </option>
<option value="#">This is a Place Holder text </option>
</select>
<input type="button" name="test" value="Go!"
onClick="gothere()">
</form>
<script>
<!--
//STEP 1 of 2: DEFINE the main category links below
//EXTEND array as needed following the laid out structure
//BE sure to preserve the first line, as it's used to display main title
var category=new Array()
category[0]=new Option("SELECT A CATEGORY ", "" //THIS LINE RESERVED TO CONTAIN COMBO TITLE
category[1]=new Option("Command Group", "combo1"
//STEP 2 of 2: DEFINE the sub category links below
//EXTEND array as needed following the laid out structure
//BE sure to preserve the LAST line, as it's used to display submain title
var combo1=new Array()
combo1[0]=new Option("Commanding General","cg.htm"
combo1[1]=new Option("Command Sergeant Major","csm.htm"
combo1[2]=new Option("BACK TO CATEGORIES","" //THIS LINE RESERVED TO CONTAIN COMBO SUBTITLE
var curlevel=1
var cacheobj=document.dynamiccombo.stage2
function populate(x){
for (m=cacheobj.options.length-1;m>0;m--)
cacheobj.options[m]=null
selectedarray=eval(x)
for (i=0;i<selectedarray.length;i++)
cacheobj.options=new Option(selectedarray.text,selectedarray.value)
cacheobj.options[0].selected=true
}
function displaysub(){
if (curlevel==1){
populate(cacheobj.options[cacheobj.selectedIndex].value)
curlevel=2
}
else
gothere()
}
function gothere(){
if (curlevel==2){
if (cacheobj.selectedIndex==cacheobj.options.length-1){
curlevel=1
populate(category)
}
else
location=cacheobj.options[cacheobj.selectedIndex].value
}
}
//SHOW categories by default
populate(category)
//-->
</script>
<script language="JavaScript">
<!--
Thanks for any help
DJF
Here is the script
<form name="dynamiccombo" target="_blank">
<select name="stage2" size="1" onChange="displaysub()">
<option value="#">This is a place Holder text </option>
<option value="#">This is a Place Holder text </option>
<option value="#">This is a Place Holder text </option>
<option value="#">This is a Place Holder text </option>
</select>
<input type="button" name="test" value="Go!"
onClick="gothere()">
</form>
<script>
<!--
//STEP 1 of 2: DEFINE the main category links below
//EXTEND array as needed following the laid out structure
//BE sure to preserve the first line, as it's used to display main title
var category=new Array()
category[0]=new Option("SELECT A CATEGORY ", "" //THIS LINE RESERVED TO CONTAIN COMBO TITLE
category[1]=new Option("Command Group", "combo1"
//STEP 2 of 2: DEFINE the sub category links below
//EXTEND array as needed following the laid out structure
//BE sure to preserve the LAST line, as it's used to display submain title
var combo1=new Array()
combo1[0]=new Option("Commanding General","cg.htm"
combo1[1]=new Option("Command Sergeant Major","csm.htm"
combo1[2]=new Option("BACK TO CATEGORIES","" //THIS LINE RESERVED TO CONTAIN COMBO SUBTITLE
var curlevel=1
var cacheobj=document.dynamiccombo.stage2
function populate(x){
for (m=cacheobj.options.length-1;m>0;m--)
cacheobj.options[m]=null
selectedarray=eval(x)
for (i=0;i<selectedarray.length;i++)
cacheobj.options=new Option(selectedarray.text,selectedarray.value)
cacheobj.options[0].selected=true
}
function displaysub(){
if (curlevel==1){
populate(cacheobj.options[cacheobj.selectedIndex].value)
curlevel=2
}
else
gothere()
}
function gothere(){
if (curlevel==2){
if (cacheobj.selectedIndex==cacheobj.options.length-1){
curlevel=1
populate(category)
}
else
location=cacheobj.options[cacheobj.selectedIndex].value
}
}
//SHOW categories by default
populate(category)
//-->
</script>
<script language="JavaScript">
<!--
Thanks for any help
DJF