PDA

View Full Version : how to externally link javascript that has arrays



tonyledenko
03-02-2009, 07:22 PM
Hello.

I am using a double combox on my site. I need to externally link the javascript for it to work for my text/html DotNetNuke module application. I tried to externally link it, but it doesn't work. Any suggestions would be great.


<form name="doublecombo">
<TABLE cellSpacing=0 cellPadding=0 width="684" border=0 bgcolor="#ffffff">
<TR>
<TD width="480" class="content">
<span class="subalt">GPS Mount Links</span><br />
Choose your device make then model. The results will show your device cradle and compatible mounting systems.
To build a complete mounting system add your cradle (RAM-HOL-XXX) and mounting system (RAM-B-XXX or RAP-B-XXX or RAP-SB-XXX).<br /><br />
<select name="example" onChange="redirect(this.options.selectedIndex)" style="WIDTH:230px; FONT-SIZE: 12px">
<option>CHOOSE GPS MAKE</option>
<option>BENDIX/KING</option>
<option>BUSHNELL</option>
<option>DELORME</option>
</select>
<br /><br />
<select name="stage2" style="WIDTH:230px; FONT-SIZE: 12px">
<option></option>
</select>
<input type="button" name="test" value="Go!" style="FONT-SIZE: 10px"
onClick="go()">
<script>

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()

group[1][0]=new Option("AV80R","pd2b.htm")

group[2][0]=new Option("ONIX400","bushnell_mounts.htm")
group[2][1]=new Option("ONIX400CR","bushnell_mounts.htm")

group[3][0]=new Option("EARTHMATE GPS PN-20","del1.htm")
group[3][1]=new Option("EARTHMATE GPS PN-40","del1.htm")

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(){
document.getElementById("search").src=temp.options[temp.selectedIndex].value
}

//-->
</script>

</TD>
<TD width="204" align="left" valign="middle"><img height=85 src="buildmount.gif" width=185 border=0 /></TD>
</TR>
<TR>
<TD colspan=2 height="15"></TD>
</TR>
<TR>
<TD colspan=2><iframe id="search" name="photos_frame" src="" width=684 height=1800 marginwidth=0 frameborder=0 scrolling=no></iframe></TD>
</TR>
</TABLE>
</form>