Simple js code to achieve selece secondary linkage of recommendation
- 2020-03-30 01:44:35
- OfStack
Here is the HTML code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<!-- by sundful starting-->
<BODY>
<script language="JavaScript">
var subcat = new Array();
subcat[0] = new Array(' Chinese ',' English ',' English ')
subcat[1] = new Array(' Chinese ',' French ',' French ')
subcat[2] = new Array(' English ',' Chinese ',' Chinese ')
subcat[3] = new Array(' French ',' Chinese ',' Chinese ')
function changeselect1(locationid)
{
document.form1.s2.length = 0; //Initializing the drop-down list & NBSP; Empty the drop-down data & NBSP;
document.form1.s2.options[0] = new Option('== Please select a ==',''); //Give the first value & NBSP;
for (i=0; i<subcat.length; i++) //legth=20
{
if (subcat[i][0] == locationid) //[0] [1] The first column The second column
{document.form1.s2.options[document.form1.s2.length] = new Option(subcat[i][1], subcat[i][2]);} //Establish option
//For the first time Length = 1 Because there is == please choose ==& NBSP;
//When I = 9 Length = 10 There are 11 & NBSP; Because it starts at zero & NBSP; Subcat [I] [0] = = Locationid masking re-write & NBSP;
}
}
</script>
<form name="form1" method="post" runat="server">
Secondary linkage:
<select name="s1" onChange="changeselect1(this.value)">
<option>== Please select a ==</option>
<option value=" Chinese "> Chinese </option>
<option value=" English "> English </option>
<option value=" English "> French </option>
</select>
<select name="s2">
<option>== Please select a ==</option>
</select>
</form>
<!-- by sundful ending-->
</BODY>
</HTML>