| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3289 人关注过本帖
标题:为什么动态表单及网页内容都显示不出来只能显示网页背景
只看楼主 加入收藏
yourselsa
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-2-1
收藏
 问题点数:0 回复次数:7 
为什么动态表单及网页内容都显示不出来只能显示网页背景
这是网页的代码,希望大家帮我看一下,我实在是不明白了,谢谢
<body>
<%
dim UserID,IPAdd,UserPwd,NickName,TimeLogin
dim mysql,mysql1
if Request.ServerVariables("REQUEST_METHOD")="Post" then
UserID=Request.Form("UID")
UserPwd=Request.Form("PWD")
NickName=Request.Form("NickName")
'session("nickname")=NickName
set myconn=server.CreateObject("ADODB.Connection")
myconn.ConnectionString="DSN=ChatRoom"
myconn.Open
mysql="select UserID,PWD,IfClosed,OpenTime from EverUser where UserID='"& UserID &"' and UserPwd='"& UserPwd &"'"
mysql1="select IPAdd,TimeOpen,IfClosed from FaultIpAdd where IPAdd='"& Request.ServerVariables("Remote_Host") &"'"
mysql2="update EverUser set NickName='"& NickName &"',IPAdd='"& Request.ServerVariables("Remote_Host") &"',TotalVisit=TotalVisit+1 where UserID='"& UserID &"'"
mysql3="insert into UserOnLine(UserID,PWD,NickName) values ('"& UserID &"','"& UserPwd &"','"& NickName &"')"
mysql4="select * from RoomInfo"
mysql5="select * from UserOnline where UserID='"&UserID &"'"
set myrecord0=myconn.Execute(mysql5)
if not myrecord0.bof then
if dateadd("n",5,myrecord0("TimeLastTalking"))>now then
Response.Write("你已经登录过了,请在五分钟后再登录?")
Response.End
else
newsql="delete from UserOnline where UserID='"&UserID&"'"
end if
end if
set myrecord1=myconn.Execute(mysql1)
if not myrecord1.BOF then
if myrecord1("IfClosed")<>true then
IfClosed=1
end if
end if
if myrecord1.bof or IfClosed=1 then
set myrecord=myconn.Execute(mysql)
if myrecord.eof then
Response.Write ("密码或账号输入错误!<a href='default.asp'>请重新登录</a>")
Response.End
elseif myrecord("IfClosed")then
if myrecord("OpenTime")<date() then
Response.Write("你的账号刚刚被解封,<a href='default.asp'>请重新登录</a>,以后请注意!")
mysql="update EverUser set IfClosed=false where UserID='"&UserID&"'"
myconn.Execute(mysql)
Response.End
else
Response.Write("你的账号已经被封,到"&myrecord("OpenTime")&"才开放!")
Response.End
End if
else
if session("refresh")=""then
myconn.Execute(mysql2)
myconn.Execute(mysql3)
session("refresh")=true
end if
set myrecord2=myconn.Execute(mysql4)
%>

<form name="room" action="main.asp" method="Post" onsubmit="javascript:return check()">
<table border="5" width="100%" bgcolor="#FF99CC" height="39" cellspacing="5" cellpadding="5">
<tr>
<td width="50%" height="18">
<p align="center"><b><font color="#ff0000">新建聊天室</font></b></p>
</td>
<td width="50%" height="18">
<p align="center"><b><font color="#ff0000">话题</font></b></P>
</td>
<td width="50%" height="18">
<p align="center"><input name="B1" type="submit" id="B1" style="BACKGROUND-COLOR:#00FFFF;COLOR:#FF0000;FONT-WEIGHT:BOLD;TEXT-DECORATION:BLINK" value="提交">
</P>
</td>
</tr>
<tr>
<td width="50%" height="9">
<p align="center"><input name="newroom"></p>
</td>
<td width="50%" height="9">
<p align="center"><input name="topic"></p>
</td>
<td width="50%" height="9">
<p align="center"><input type="reset" value="清除" name="B2" style="background-color:#00ffff;color:#ff0000;font-weight:bold;text-decoration:blink">
</p>
</td>
</tr>
</table>
<input type="hidden" name="user" value=<%=UserID%>>
</form>
<hr size="4" color="#000080">
<!--下面的表单为显示房间信息-->
<table border="2" width="100%" background="images/bg1.gif" cellpadding="2" height="76">
<tr>
<td width="10%" align="middle" height="48"><div align="center" class="style6"><font size="3" color="#008000">房间号</font> </div></td>
<td width="20%" align="middle" height="48"><div align="center" class="style6"><font size="3" color="#008000">房间名称</font> </div></td>
<td width="20%" align="middle" height="48"><div align="center" class="style6"><font size="3" color="#008000">话题</font> </div></td>
<td width="20%" align="middle" height="48"><div align="center" class="style6"><font size="3" color="#008000">聊天人数</font> </div>
<td width="15%" align="middle" height="48"><div align="center" class="style6"><font size="3" color="#008000">是否上锁</font> </div>
<td width="15%" align="middle" height="48"><div align="center" class="style6"><font size="3" color="#008000">创建者</font> </div></td>
</tr>
<%
do while not myrecord2.eof
if myrecord2("IfLocked")=true then
newsql="select UserID from UserOnLine where RoomName='"&myrecord2("RoomName")&"'and UserID='"&myrecord2("WhoCreate")&"'"
set myrecord3=myconn.Execute(newsql)
if myrecord3.bof then
newsql="update RoomInfo set IfLocked=false where RoomName='"&myrecord2("RoomName")&"'"
myconn.Execute(newsql)
Changed=true
end if
myrecord3.close
end if
%>
<tr>
<td width="10%" align="middle" height="2"><p align="center" class="style6"><font color=purple size=5>
<% =myrecord2("RoomID")%>
</font></p></td>
<%
if myrecord2("IfLocked")=false or Changed=true then
%>
<td width="20%" align="middle" height="2"><span class="style7"><font color=purple size=5><strong> <%=myrecord2("RoomName")%> </strong></font><font color=maroon size=2>
<!--显示进入房间链接-->
<a href=main.asp?roomname=<% =myrecord2("RoomName") %>&user=<%=UserID%>>进入</a></font> </span></td>
<%
else
%>
<td width="20%" align="middle" height="2"><span class="style7"><font color=purple size=5><strong>
<!--显示房间名-->
<%=myrecord2("RoomName")%> </strong></font><font color=maroon size=2>锁住</font> </span></td>
<%
end if
%>
<td width="20%" align="middle" height="2"><div align="center" class="style7"><font color=purple><strong>
<!--显示房间话题-->
<%=myrecord2("Topic")%> </strong></font>
<p></p>
</div></td>
<td width="20%" align="middle" height="2"><p align="center" class="style7"><font color=purple><strong>
<!--显示房间人数-->
<% =myrecord2("HowManyUsers")%>
</strong></font></p></td>
<td width="15%" align="middle" height="2"><p align="center" class="style7"><font color=purple><strong>
<!--显示房间状态-->
<%=myrecord2("IfLocked")%> </strong></font></p></td>
<td width="15%" align="middle" height="2"><p align="center" class="style7"><font color="purple"><strong>
<!--显示房间创建者-->
<% =myrecord2("WhoCreate") %>
</strong></font></p></td>
</tr>
<p>
<%

myrecord2.movenext
loop
%>
</table>
<div align="center">
<%
end if
else

if myrecord1("TimeOpen")<date() then
Response.Write("你的IP地址刚刚被解封,<a href='default.asp'>请重新登录</a>,请以后注意!")
mysql="update FaultIpAdd set IfClosed=false where IpAdd='"&Request.ServerVariables("Remote_Host")&"'"

myconn.Execute(mysql)
Response.End
else
Response.Write("你的IP地址已经被封住了,直到"&myrecord1("TimeOpen")&"才能开放!")
Response.End
end if
end if

myrecord.close
set myrecord=nothing
myrecord1.close
set myrecord1=nothing
myrecord2.close
set myrecord2=nothing
set myconn=nothing
end if
%>

</p>
</div>
</body>
</html>

[此贴子已经被作者于2006-2-1 22:00:11编辑过]

搜索更多相关主题的帖子: 网页 表单 动态 
2006-02-01 20:22
meqoo
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2006-2-1
收藏
得分:0 
问题不在ASP源码上
你可以找找HTML源码看是不是有错误

2006-02-02 15:02
yourselsa
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-2-1
收藏
得分:0 

好啊,非常感谢。我再查查。不过我把asp代码去掉,html表格就可以显示出来,加上asp代码后就什么也显示不出来了。


2006-02-02 19:45
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
Response.End可能有问题,最好先注释掉看看什么提示。
2006-02-02 21:19
yourselsa
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-2-1
收藏
得分:0 

我试过了,问题在这句话
if Request.ServerVariables("REQUEST_METHOD")="Post" then
这句话的功能体现不出来,去掉它就能显示了,不知道这句为什么不好用啊,我的另一个网页页有这句,也犯这个毛病啊
怎么回事呢


2006-02-05 12:28
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
if Request.ServerVariables("REQUEST_METHOD")="POST" then

2006-02-05 12:36
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
Request.ServerVariables("REQUEST_METHOD")="Post"

是判断上页中的表单动作类型,有POST和GET两种

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2006-02-05 14:01
yourselsa
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-2-1
收藏
得分:0 

我找到错误了,真是太感激rainic了,就是你说的那个错误
if Request.ServerVariables("REQUEST_METHOD")="POST
" then
post要大写,
我太感谢你了,我激动死了,当然也要感谢yms123
阳光白雪,meqoo,感谢asp技术论坛,谢谢你们
对我的问题的关注!


2006-02-06 12:16
快速回复:为什么动态表单及网页内容都显示不出来只能显示网页背景
数据加载中...
 
   



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

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