我用如下代码做了一个不用换页更新内容的网页,就是不用点“提交”,只需点下拉菜单
中的项目就自动更新显示内容,但是当内容发生变化时,页面却不能刷新,点“刷新”后才能显示变化后的内容。还有没有更好的不换页的好方法?不知你们听明白了吗?
atype.asp:
1cc=request.querystring("cc")
1<form action="atype.asp" method="POST">
set dbConnect=Server.CreateObject("ADODB.Connection")
dbConnect.Open "jin","",""
set dbRS=dbConnect.Execute("SELECT * FROM tab where f1="&cc&" ")
set dbRS1=dbConnect.Execute("SELECT distinct 类型 FROM tab "
1<p align="left" style="margin-top: -4; margin-bottom: -4">选择类型:<select name="d1" onchange="window.open(this.options[this.selectedIndex].value,'_self')" size="1" style="background-color: #CCFFFF" target="_top">
Do While Not dbRS1.EOF
1<option value="atype.asp?cc=```
2=dbRS1(0)
3```">```
4=dbRS1(0)
1 dbRS1.MoveNext
2Loop
3```</option></select></p></form>
。。。。。。
---------------------------------------------------------------
首先,你的数据库应该这样安排:
省表 sheng 城市表 city
sid sname cid cname sid
1 北京 1 密云县 1
2 广东 2 广州 2
3 ..... 3 深圳 2
4 珠海 2
5 ....
1
2dim rs
3dim sql
4dim count
5set rs=server.createobject("adodb.recordset")
6sql = "select * from city order by cid asc"
7rs.open sql,conn,1,1
1<script language="JavaScript">
2var onecount;
3onecount=0;
4subcat = new Array();
count = 0
do while not rs.eof
1subcat[```
2=count
3```] = new Array("```
4= trim(rs("cname"))
5```","```
6= trim(rs("sid"))
7```","```
8= trim(rs("cid"))
9```");
count = count + 1
rs.movenext
loop
rs.close
1onecount=```
2=count
3```;
4
5function changelocation(locationid)
6{
7document.form1.city.length = 0;
8
9var locationid=locationid;
10var i;
11for (i=0;i < onecount; i++)
12{
13if (subcat[i][1] == locationid)
14{
15document.form1.city.options[document.form1.city.length] = new Option(subcat[i][0], subcat[i][2]);
16}
17}
18
19}
20</script>
1<script language="javascript">
2<!--
3function CheckForm()
4{
5document.form1.txtcontent.value=document.form1.doc_html.value;
6return true
7}
8//-->
9</script>
1<body>
2<form name="form1" onsubmit="check()">
3省份 ```
4
5sql = "select * from sheng"
6rs.open sql,conn,1,1
7if rs.eof and rs.bof then
8response.write "请先添加省份。"
9response.end
10else
do while not rs.eof
<option
"="" selected="" sid"))="" value=" =trim(rs(">
=trim(rs("sname"))
rs.movenext
loop
end if
rs.close
1</select>
2城市:<select name="cid">
3<option selected="" value="">==请选城市==</option>
4</select>
5</form>
6</body>
测试通过没问题