In my Javascript I want to add a third section, which calls a "option C" in my select statement. I am not able to get the correct syntax in the Javascript. Using the return in the javascript in the current location will show the first and second section, but when I add the third section nothing works. Does anyone have any ideas on the syntax?. In addtion, I want to stay with this format in the the Javascript.
<!-- Javascript: -->
<script language="JavaScript1.2">
function whichColour(obj){
if(obj.group_name.selectedIndex == 1)
<!-- Section 1 -->
{
obj.directory.length=2
obj.directory.options[0].value="msds_pds/QEP Product Data Sheets/"
obj.directory.options[0].text="msds_pds/QEP Product Data Sheets/"
obj.directory.selectedIndex = 0
return
}
<!-- Section 1 -->
obj.directory.length=2
obj.directory.options[0].value="msds_pds/CANADA/Product Data Sheet/CANPDS/"
obj.directory.options[0].text="msds_pds/CANADA/Product Data Sheet/CANPDS/"
obj.directory.selectedIndex = 0
<!-- Section 3, this is the section I want to add but the syntax is not correct-->
obj.directory.length=2
obj.directory.options[0].value="msds_pds/test/"
obj.directory.options[0].text="msds_pds/test/"
obj.directory.selectedIndex = 0
}
</script>
<!-- Select statement: -->
<td>
<select name="selectBorder" onchange="whichColour(this.form)">
<option>-- select --</option>
<option value="QEP Product Datasheets">QEP Product Datasheets</option>
<option value="Roberts Adhesive Product Datasheets (Canada English)">Roberts Adhesive Product Datasheets (Canada English)</option>
<option value="Roberts Adhesive Product Datasheets (USA)">Roberts Adhesive Product Datasheets (USA)</option>
</select>
</td>
<td>
<select name="selectColour" onchange="whichColour(this.form)">
<option> </option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</td>
<!-- Javascript: -->
<script language="JavaScript1.2">
function whichColour(obj){
if(obj.group_name.selectedIndex == 1)
<!-- Section 1 -->
{
obj.directory.length=2
obj.directory.options[0].value="msds_pds/QEP Product Data Sheets/"
obj.directory.options[0].text="msds_pds/QEP Product Data Sheets/"
obj.directory.selectedIndex = 0
return
}
<!-- Section 1 -->
obj.directory.length=2
obj.directory.options[0].value="msds_pds/CANADA/Product Data Sheet/CANPDS/"
obj.directory.options[0].text="msds_pds/CANADA/Product Data Sheet/CANPDS/"
obj.directory.selectedIndex = 0
<!-- Section 3, this is the section I want to add but the syntax is not correct-->
obj.directory.length=2
obj.directory.options[0].value="msds_pds/test/"
obj.directory.options[0].text="msds_pds/test/"
obj.directory.selectedIndex = 0
}
</script>
<!-- Select statement: -->
<td>
<select name="selectBorder" onchange="whichColour(this.form)">
<option>-- select --</option>
<option value="QEP Product Datasheets">QEP Product Datasheets</option>
<option value="Roberts Adhesive Product Datasheets (Canada English)">Roberts Adhesive Product Datasheets (Canada English)</option>
<option value="Roberts Adhesive Product Datasheets (USA)">Roberts Adhesive Product Datasheets (USA)</option>
</select>
</td>
<td>
<select name="selectColour" onchange="whichColour(this.form)">
<option> </option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</td>