首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

小弟我研究了几天还是不懂,还望高手帮忙指点!多谢

2012-03-05 
我研究了几天还是不懂,还望高手帮忙指点!谢谢!我用ASP做一个BBS系统,其中用下拉列表统计在线用户,本来要达

我研究了几天还是不懂,还望高手帮忙指点!谢谢!
我用ASP做一个BBS系统,其中用下拉列表统计在线用户,本来要达到的效果是:通过下列表选中用户名然后转到guestinfo.asp查看该用户的信息.可是结果功能没达到,下面的代码我也不知道那里错了,帮我看看好吗?谢谢了.

<%  
  Set   conn=Server.CreateObject( "ADODB.Connection ")

connstr= "Provider=SQLOLEDB.1;Password=123456;Persist   Security   Info=True;User   ID=sa;Initial   Catalog=shujuku;Data   Source=(local);Connect   Timeout=15 "  
conn.Open   connstr
set   rs=server.CreateObject( "adodb.recordset ")
serialnum=request.querystring( "serialnum ")
query= "select*from   currentuser   where   serialnum= ' "&serialnum& " ' "
rs.open   query,conn,1,3
 
%>      
<%check   =request( "serialnum ")%>

<html>

<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<meta   http-equiv= "refresh "   content= "10;url=userlist.asp?serialnum= <%=request( "serialnum ")%> ">
<title> 当前用户列表 </title>
<style   type= "text/css ">
<!--
a:visited,a:link{text-decoration:none;color:#003399}
a:hover{text-decoration:none;color:#3333ff}
a.linkwhite:link,a.linkwhite:visited{text-decoration:none;color:white}
a.linkwhite:hover{text-decoration:underline;color:white}
a.linkblack:link,a.linkblack:visited{text-decoration:none;color:black}
a.linkblack:hover{text-decoration:underline;color:black}
input{font-family: "宋体 ";font-size:9pt}
td{font-family: "宋体 ";font-size:9pt;color:#000000}
.en{font-family: "verdana ", "arial ";font-size:9pt}
.white{color:#ffffff}
.line{line-height:20px}
.title{font-size:14px}
-->
</style>

<%
sql= "select   *   from   ever_user   where   uid   in( "
sql=sql& "select   uid   from   currentuser   where   serialnum= ' "&request( "serialnum ")& " ') "
set   save_rs=conn.execute(sql)
    if   save_rs.eof   or   save_rs.bof   then
            response.write "你的帐号已经过期,请重新登录或注册新的用户。 <br> "
    response.end
    else
            if   isnull(save_rs( "totaltime "))then
    totaltime=0
      else
              totaltime=save_rs( "totaltime ")
      end   if
      totaltime=totaltime+1
      sql= "update   ever_user   set   totaltime= ' "&totaltime& " '   where   uid= ' "&save_rs( "uid ")& " ' "
      conn.execute(sql)
    end   if
    set   currentuserrs=conn.execute( "select*from   currentuser ")
    set   newfile=conn.execute( "select*from   new_essay ")
     
      on   error   resume   next
      currentuserrs.movefirst
      newfile.movefirst
      if   not   currentusers.eof   then
      %>
      <script   language= "javascript ">
      <!--


      //window.alert( "guestinfo.asp? "&&document.user.userid.options[selectedindex].value)
      function   go()
      {
            if(document.user.userid.selectedindex!=0)
    {
              index=document.user.userid.selectedindex
      parent.frames.[2].location.href= "guestinfo.asp? "+document.user.userid.option[index].value
      //window.alert( "guestinfo.asp? "+document.user.userid.options[index].value)
      }
          }
  function   readnew()
  {
        if(document.user.newfile.selectedindex!=0)
{
      index=document.user.newfile.selectedindex
      parent.frames[2].location.href=document.user.newfile.option[index].value
      }
  }
  //-->
  </script>
  </head>
 
<body   bgcolor= "#99CCFF "   link= "#ff0000 "   vlink= "#0000ff "   alink= "#008080 ">
<form   method= "post "   name= "user "   action= " "   onsubmit= " ">
 
    <p> &nbsp;
    <p> &nbsp;
    <p> <b> <font   face= "华文楷体 "color= "#000000 "size= "2 "> 在线用户: </font> </b>
    <p>  
        <select   size= "1 "   name= "userid "   style= "font-size:8pt;color:#0000ff ">
            <option   value= "all "   selected> 所有成员 </option>
            <%
    do   while   not   currentuserrs.eof%>
            <option
value= " <%=request( "serialnum ")%> &target= <%=currentuserrs( "uid ")%> ">  
            <%=currentuserrs( "uid ")%> </option>
            <%
      currentuserrs.movenext
      loop
      %> &nbsp
           
        </select>

    <p> <b> <font   face= "华文楷体 "   color= "#000000 "size= "2 "> 最新发表文章列表: </font> </b>
    <p>   <font   color= "#000000 ">
        <select   size= "1 "   name= "newfile "   style= "font-size:8pt;color:#0000ff "   onclick= "readnew() ">
            <option> 新文章 </option>
            <%do   while   not   newfile.eof%>
            <option   value= "showdetial.asp?serialnum= <%=request( "serialnum ")%> &
      num= <%=newfile( "fileid ")%> "selected> <%=newfile( "uid ")%> -- <%=newfile( "theme ")%> </option>
            <%


          newfile.movenext
  loop  
  %>
        </select>
        </font>
    <p> <font   face= "华文楷体 "   color= "#000000 "   size= "2 "> <b>   <a   href= "list.asp?serialnum= <%=request( "serialnum ")%> "target= "top "> 刷新文章 </a> </b> </font>  
    <p>   <font   face= "华文楷体 "   color= "#ff0000 "   size= "2 "> <b>   <a   href= "addnew.asp?serialnum= <%=request( "serialnum ")%> "target= "bottom "> <font   color= "#000000 "> 发表文章 </font>  
        <br>
        <br> </a> </b> </font>
<%
sql= "select   info,newinfo,currentuser.uid   from   ever_user,currentuser   where   ever_user.uid=currentuser.uid   and   currentuser.serialnum= ' "&request( "serialnum ")& " ' "
set   info=conn.execute(sql)
%>
<%if   info( "newinfo ")=0   then
title= "查看以前的留言 "
else
title= "朋友给你的留言 "
end   if%>
<b>
<font   face= "华文楷体 "   color= "#ff0000 "   size= "2 ">
<a   href= "showinfo.asp?
serialnum= <%=request( "serialnum ")%> "   target= "bottom ">
<%   =title   %> </a> </font>
<br>
</form>
<%   end   if   %>
<p> </p>
</body>
</html>


[解决办法]
function go()
{
if(document.user.userid.selectedindex!=0)
{
index=document.user.userid.selectedindex
parent.frames.[2].location.href= "guestinfo.asp? "+document.user.userid.option[index].value
//--这里guestinfo.asp?后面的参数名称怎么没有了?——————
}
}

[解决办法]
<select size= "1 " name= "userid " style= "font-size:8pt;color:#0000ff " onclick= "javascript:parent.frames.[2].location.href= 'guestinfo.asp?aa= '+this.options[this.selectedIndex].value
">
//aa为自定义的参数名称,badwish(阿良(努力寻找另一半)) 说的没错
//有这个参数名称你才可以在处理页面调用request.querystring( "aa ")获取

热点排行