Javascript Implementation dropdown list, hint: Array not defined
Source: Internet
Author: User
There is an application that requires a drop down list (class1) change to trigger the change of another dependency list (Class2). In reference to the dropdown box (database version), there are the following pieces of the program:
<% sql = "SELECT ID, Name, substring (id,1,2) Bigclass from Classone where type= ' 1 ' ORDER by ID"
Set rs = Session ("conn"). Execute (SQL)
%>
<script language= "JavaScript" >
var onecount = 0;
subcat = new Array (); <---------tip: Array not defined------------
<% count = 0
Do, not rs.eof <---------RS is already a previously defined recordset
%>
Subcat[<%=count%>] = new Array ("<%=trim (RS (" name))%> "," <%=trim (RS ("Bigclass"))%> "," <%=trim ( RS ("id"))%> ");
<% count = count+1
Rs.movenext
Loop
Rs.close
Set rs = Nothing
%>
Onecount = <%=count%>
function Chgcls () {
for (var i=document.search.class2.options.length; i>0; i--) {
Document.search.class2.options[i]=null;
}
for (i = 0; i<onecount; i++) {
Bigclass = "'" &subcat[i][1]& "";
if (Document.search.class1.options[document.search.class1.selectedindex].value==bigclass) {
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service