问题描述:
javascript脚本中写入asp程序可以吗?怎么理解这样的写法呀,那位高人给看看这段程序是什么意思?
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from Nclass order by Nclassid asc"
rs.open sql,conn,1,1
%>
<SCRIPT language="JavaScript">
var onecount
onecount=0
subcat = new Array()
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("Nclass"))%>","<%= trim(rs("classid"))%>","<%= trim(rs("Nclassid"))%>")
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>
解析:
asp 先处理,然后发给浏览器处理javascript
document.write("<div id=AdLayer1 style='position: absolutevisibility:hiddenz-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>"+"<div id=AdLayer2 style='position: absolutevisibility:hiddenz-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>")
js函数中好像不能嵌套asp吧?可以用ajax无刷新的二级联动一级select里面加入onchange
例<select name="teacher_name" id="teacher_name" onChange="showStudent(this.value)">
js中采用xmlHttp对象把查询关键字发送到另外一个asp页面进行查询,并用xmlHttp的responseText方法获得查询得到的二级select需要的数据,动态产生二级select
如果不会xmlHttp,可以到网上查查相关资料
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)