标题:关于下拉框选择项目,内容显示所有,页面刷新,但不归类。
只看楼主
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
结帖率:100%
已结贴  问题点数:7 回复次数:8 
关于下拉框选择项目,内容显示所有,页面刷新,但不归类。
选择下拉框内项目时页面刷新,但是依旧显示所有内容,没有刷出分类效果。高手看一下哪里没改好。
页面图片

源代码如下:
程序代码:
<%if request.Cookies("shiwei_username")="" then%>
<script language="javascript">top.location.href="../index.asp"</script>
<% 
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<!-- #include file="../const.asp" -->
<!-- #include file="../inc/function.asp" -->
<html>
<head>
<title>水费到期提醒</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>body {background-color:#FFFFFF;}</style>
<script>
function CheckAll(form) {
  for (var i=0;i<form.elements.length;i++) {
    var e = form.elements[i];
    if (e.name != 'chkall')  e.checked = form.chkall.checked;
  }
}
</script>
</HEAD>

<BODY>
<%if fla25="0" and request.Cookies("shiwei_id")<>"1" then%>
<br><center><img src="../images/note.gif" align="absmiddle">&nbsp;<font color="#FF0000">你不具备此权限,请与管理员联系!</font></center>
<%
  response.end
end if
if request("hid")="ok" then
  conn.execute("update yezhu set wenhou=#"&date()&"# where id="&request("id"))
end if
nowxiaoqu=request("xiaoqu")
%>

<table width="100%" border="0" cellpadding="0" cellspacing="2" align="center">

 <form name="form2">
   <tr>
     <td width="1%" height="30">&nbsp;</td>
       <td width="99%" align="left">
        <%
    sql="select * from xiaoqu order by id"
    set rs_qu=conn.execute(sql)
    %>
    请选择小区:
    <select name="xiaoqu" onChange="form2.submit()">
        <option value="">所有小区</option>
        <%do while rs_qu.eof=false%>
        <option value="<%=rs_qu("id")%>"<%if trim(cstr(rs_qu("id")))=nowxiaoqu then%> selected="selected"<%end if%>><%=rs_qu("xiaoqu")%></option>
        <%
    rs_qu.movenext
    loop
    %>
      </select></td></tr></form></table>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
  <tr><td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;水费到期提醒</td>
    <td align="right">&nbsp;</td>
      </tr>
    </table>
  </td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<form name="form1" >
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1" width="100%">
  <tr align="center">
    <td class="category" height="30">所在小区</td>
      <td class="category">楼宇单元</td>
        <td class="category">房号</td>
    <td class="category">业主姓名</td>
    <td class="category">电话</td>
    <td class="category">缴费日期</td>
    <td class="category">操作</td>
      </tr>
    <%
    if nowxiaoqu="" then
    sql="select * from yezhu order by xiaoqu,id"
    else
    sql="select * from yezhu where xiaoqu="&nowxiaoqu&" order by id"
    end if

sql="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&" and (shui)>="&day(date())&" and day(shui)<="&day(date()+5)&") and year(wenhou)<>"&year(date())&")"
'sql="select * from yezhu where (datediff('y','"&date()&"',shengri)>=0 and datediff('y','"&date()+tiqian&"',shengri)<=0 and yinyang='阳') or (datediff('y','"&WDateToEDate(now(),"1")&"',shengri)>=0 and datediff('y','"&WDateToEDate(now(),"1")+tiqian&"',shenri)<=0 and yinyang='阴')"
set rs_yezhu=conn.execute(sql)
do while rs_yezhu.eof=false

    %>
    <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">
    <td align=center height=25><%set rs_qu=conn.execute("select * from xiaoqu where id="&rs_yezhu("xiaoqu"))%><%if rs_qu.eof then%><%else%><%=rs_qu("xiaoqu")%><%end if%></td>
        <td align=center><%=rs_yezhu("louyu")%></td>
    <td align=center><%=rs_yezhu("fanghao")%></td>
    <td align=center><%=rs_yezhu("username")%></td>
    <td align=center><%=rs_yezhu("tel")%></td>
    <td align=center><%=rs_yezhu("shui")%></td>
    <td align=center><input type=button value='开始收费' onClick=window.open("/1/produit/produit_sell.asp") class="button">&nbsp;&nbsp;<input type=button value='已经缴费,取消提醒' onclick=window.location.href='?hid=ok&id=<%=rs_yezhu("id")%>' class="button"></td>
    </tr>
<%
  nowbaojing1=nowbaojing1&"ok"
  rs_yezhu.movenext
loop
%>
<%if nowbaojing1="" then%>
  <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">
    <td align=center height=25 colspan="6" style="color:#ff0000">目前没有缴费提醒</td>
      </tr>
        <%end if%>    
        </table>
      </form>
    </td>
  <td></td>
</tr>
<tr><td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr></table></body></html>


[ 本帖最后由 天蝎风 于 2010-11-20 12:33 编辑 ]
搜索更多相关主题的帖子: 源代码 
2010-11-20 12:31
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
得分:1 
程序代码:
    if nowxiaoqu="" then
    sql="select * from yezhu order by xiaoqu,id"
    else
    sql="select * from yezhu where xiaoqu="&nowxiaoqu&" order by id"
    end if

sql="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&" and (shui)>="&day(date())&" and day(shui)<="&day(date()+5)&") and year(wenhou)<>"&year(date())&")"
在if语句后,sql语句又重写了

----我怎能在别人的苦难面前转过脸去----
2010-11-20 13:26
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
得分:0 
以下是引用dzt0001在2010-11-20 13:26:58的发言:

    if nowxiaoqu="" then
    sql="select * from yezhu order by xiaoqu,id"
    else
sql="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&" and (shui)>="&day(date())&" and day(shui)<="&day(date()+5)&") and year(wenhou)<>"&year(date())&")"
在if语句后,sql语句又重写了
  已经去掉了这句  sql="select * from yezhu where xiaoqu="&nowxiaoqu&" order by id"
    end if
但是还是不能按小区显示啊,依然显示所有小区。
 

南宁信息网http://www.
2010-11-20 13:36
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
得分:1 
核心在这句上:  <select name="xiaoqu" onChange="form2.submit()">也就是说当对select操作后,会执行form2的提交,并刷新整个页面,也就是重新执行一次上面的ASP页面!
那么显示的就是最后一次SQL查询到的数据,最后一次是什么SQL呢?你自己看看吧!

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-11-20 16:40
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
得分:0 
最后一个执行的sql="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&" and (shui)>="&day(date())&" and day(shui)<="&day(date()+5)&") and year(wenhou)<>"&year(date())&")"  将是你刷新后内容显示的结果!这句能分类吗?请参考数据库结构表看看!
如果希望分类,你需要改动的地方还是满多的。
1。表单更改:<form name="form2" action="?act=fenlei">多加了一个判断。
2。在ASP页面里加判断:建议加到<form name="form1" >下面去,具体看效果而定!
   if request("act")='fenlei' then
     ...这里加分类的SQL语句,然后将分类查到的数据再一次显示到表格里去,代码比较多!
     response.end '结束语句执行,不然后面就会显示第二个全部小区数据的了。
    end if

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-11-20 16:48
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
得分:1 
<%
    if nowxiaoqu="" then
    sql="select * from yezhu order by xiaoqu,id"
    else
    sql="select * from yezhu where xiaoqu="&nowxiaoqu&" order by id"
    end if

sql="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&" and (shui)>="&day(date())&" and day(shui)<="&day(date()+5)&") and year(wenhou)<>"&year(date())&")"
最后那个sql不要。:sql="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&" and (shui)>="&day(date())&" and day(shui)<="&day(date()+5)&") and year(wenhou)<>"&year(date())&")"

QQ:63572063
2010-11-20 18:20
zhaopubin
Rank: 1
等 级:新手上路
帖 子:1
专家分:1
注 册:2010-11-23
得分:1 
路过
2010-11-23 13:18
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
得分:0 
以下是引用wangjy500在2010-11-20 18:20:30的发言:

 
不行啊这样

南宁信息网http://www.
2010-11-23 14:07
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
得分:0 
以下是引用wangjy500在2010-11-20 18:20:30的发言:
最后那句不要的话,列表会显示所有业主,当然也可以选择下拉框小区,但是我想的是只显示即将或已经到期缴费的业主。

南宁信息网http://www.
2010-11-26 11:47



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-326317-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.100809 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved