关于ASP循环现实的问题!请大侠指导!跪求!

sayu820115 2006-07-11 04:34:54
小弟以下程序是实现显示制定内容的代码!但只能静态显示,无法实现循环显示数据库信息!请各位大侠指教循环显示方法,并给出代码。小弟不胜感激!

<!--#include file="conn.asp"--><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>许愿墙</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript1.2">
//-- 控制层删除start of script -->
function ssdel(){
if (event)
{
lObj = event.srcElement ;

while (lObj && lObj.tagName != "DIV") lObj = lObj.parentElement ;
}
var id=lObj.id
document.getElementById(id).removeNode(true);
//document.getElementById(id).outerHTML="";//
}

//-- 控制层删除End of script -->
</script>
<script>
//-- 控制层移动start of script -->
var Obj=''
var index=10000;//z-index;
document.onmouseup=MUp
document.onmousemove=MMove

function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
document.all(Obj).style.left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}

function MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}
}
//-- 控制层移动end of script -->
//获得焦点;
function getFocus(obj)
{
if(obj.style.zIndex!=index)
{
index = index + 2;
var idx = index;
obj.style.zIndex=idx;
//obj.nextSibling.style.zIndex=idx-1;
}
}
//查找祝福纸条
function Srch(obj)
{//alert(obj);
if(obj.style.zIndex!=index)
{
index = index + 1000;
var idx = index;
obj.style.zIndex = idx;
obj.style.width = 400;
obj.style.height = 300;
obj.style.left = 200;
obj.style.top = 200;
}
}
function ChkSrch()
{
if (SrchFrm.srchId.value == "")
{alert("\n\n\n你总得告诉我查找哪一个吧!!\n\n\n");
SrchFrm.srchId.focus();
return false; }
return true;
}

function checkNum(obj){
var checkOK = "0123456789 ";
var checkStr = obj.value;
var allValid = true;
for (i = 0; i < checkStr.length; i++){
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length){
allValid = false;
break;
}
}
if (!allValid){
alert("只能由数字组成!");
obj.select();
return (false);
}
return (true);
}
</script>
</head>

<link rel="stylesheet" href="style0930.css" type="text/css" />

<body>
<table width="100" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><img src="image/11_2.jpg" width="546" height="160" /></td>
</tr>
</table>
<br>
<table width=700 border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#F577B9">
<tr>
<td width=67 align="center" valign="middle" id="menu"><a href="index.asp">首 页</a></td>
<td width=77 align="center" valign="middle" id="menu"><a href="write.asp">发表许愿</a></td>
<td width=95 align="center" valign="middle" id="menu"><a href="wish.asp">查看许愿</a></td>
<td width="453" align="left"><span class="white"></span></td>
</tr>
</table>
<%
dim sqlseek,i
i=1
sqlseek="select * from wish"
set rsseek=server.createobject("ADODB.Recordset")
rsseek.open sqlseek,conn,1,3
if not rsseek.eof then
%>
<div id='cc29' class='Cccc' style='position:absolute; left:662px; top:283px; background-color:#E6F2E7; z-index:29; width: 162px; height: 128px;' onmousedown='getFocus(this)'>
<table width="101%" border=0><td style='cursor:move;' width='98%' onmousedown=MDown(cc29)>第<%=rsseek("id")%>条</td><td style='cursor:hand;' onclick='ssdel()' width='2%'>×</td></tr><tr><td style='height:100px;padding:5px;' colspan='2'><div style='padding:5px;'><%=rsseek("content")%></div></td></tr><tr><td><div style='padding:5px;float:right;'><%=rsseek("writer")%></div></td></tr></table></div>
<%
end if
rsseek.movenext
if not rsseek.eof then
%>
<div id='cc28' class='Cccc' style='position:absolute; left:311px; top:257px; background-color:#E6F2E7; z-index:28; width: 162px; height: 128px;' onmousedown='getFocus(this)'>
<table width="101%" border=0><td style='cursor:move;' width='98%' onmousedown=MDown(cc28)>第<%=rsseek("id")%>条</td><td style='cursor:hand;' onclick='ssdel()' width='2%'>×</td></tr><tr><td style='height:100px;padding:5px;' colspan='2'><div style='padding:5px;'><%=rsseek("content")%></div></td></tr><tr><td><div style='padding:5px;float:right;'><%=rsseek("writer")%></div></td></tr></table></div>
<%
end if
rsseek.movenext
if not rsseek.eof then
%>
<div id='cc27' class='Cccc' style='position:absolute; left:539px; top:255px; background-color:#E6F2E7; z-index:28; width: 162px; height: 128px;' onmousedown='getFocus(this)'>
<table width="101%" border=0><td style='cursor:move;' width='98%' onmousedown=MDown(cc27)>第<%=rsseek("id")%>条</td><td style='cursor:hand;' onclick='ssdel()' width='2%'>×</td></tr><tr><td style='height:100px;padding:5px;' colspan='2'><div style='padding:5px;'><%=rsseek("content")%></div></td></tr><tr><td><div style='padding:5px;float:right;'><%=rsseek("writer")%></div></td></tr></table></div>
<%
end if
rsseek.movenext
if not rsseek.eof then
%>
<div id='cc26' class='Cccc' style='position:absolute; left:212px; top:285px; background-color:#E6F2E7; z-index:28; width: 162px; height: 128px;' onmousedown='getFocus(this)'>
<table width="101%" border=0><td style='cursor:move;' width='98%' onmousedown=MDown(cc26)>第<%=rsseek("id")%>条</td><td style='cursor:hand;' onclick='ssdel()' width='2%'>×</td></tr><tr><td style='height:100px;padding:5px;' colspan='2'><div style='padding:5px;'><%=rsseek("content")%></div></td></tr><tr><td><div style='padding:5px;float:right;'><%=rsseek("writer")%></div></td></tr></table></div>
<%
end if
rsseek.movenext
if not rsseek.eof then
%>
<div id='cc25' class='Cccc' style='position:absolute; left:434px; top:278px; background-color:#E6F2E7; z-index:28; width: 162px; height: 128px;' onmousedown='getFocus(this)'>
<table width="101%" border=0><td style='cursor:move;' width='98%' onmousedown=MDown(cc25)>第<%=rsseek("id")%>条</td><td style='cursor:hand;' onclick='ssdel()' width='2%'>×</td></tr><tr><td style='height:100px;padding:5px;' colspan='2'><div style='padding:5px;'><%=rsseek("content")%></div></td></tr><tr><td><div style='padding:5px;float:right;'><%=rsseek("writer")%></div></td></tr></table></div>
<% end if %>
<div id="div_img"></div>
</body>
</html>
...全文
123 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhenmeiyisi 2006-07-11
  • 打赏
  • 举报
回复
if not rsseek.eof then
do while not rsseek.eof
%>
内容
<%
rsseek.movenext
loop
end if %>
mucel 2006-07-11
  • 打赏
  • 举报
回复
up,我以前也碰到类似问题,但没有解决,期待中......
sayu820115 2006-07-11
  • 打赏
  • 举报
回复
ls的,首先很感谢你,但这段语句是不行的!
<%
dim sqlseek,i
i=1
sqlseek="select * from wish"
set rsseek=server.createobject("ADODB.Recordset")
rsseek.open sqlseek,conn,1,3
if not rsseek.eof then
%>
<div id='cc29' class='Cccc' style='position:absolute; left:662px; top:283px; background-color:#E6F2E7; z-index:29; width: 162px; height: 128px;' onmousedown='getFocus(this)'>
<table width="101%" border=0><td style='cursor:move;' width='98%' onmousedown=MDown(cc29)>第<%=rsseek("id")%>条</td><td style='cursor:hand;' onclick='ssdel()' width='2%'>×</td></tr><tr><td style='height:100px;padding:5px;' colspan='2'><div style='padding:5px;'><%=rsseek("content")%></div></td></tr><tr><td><div style='padding:5px;float:right;'><%=rsseek("writer")%></div></td></tr></table></div>
<%
rsseek.movenext
end if %>
shweze 2006-07-11
  • 打赏
  • 举报
回复
小弟以下程序是实现显示制定内容的代码!但只能静态显示,无法实现循环显示数据库信息!请各位大侠指教循环显示方法,并给出代码。小弟不胜感激!

<!--#include file="conn.asp"--><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>许愿墙</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript1.2">
//-- 控制层删除start of script -->
function ssdel(){
if (event)
{
lObj = event.srcElement ;

while (lObj && lObj.tagName != "DIV") lObj = lObj.parentElement ;
}
var id=lObj.id
document.getElementById(id).removeNode(true);
//document.getElementById(id).outerHTML="";//
}

//-- 控制层删除End of script -->
</script>
<script>
//-- 控制层移动start of script -->
var Obj=''
var index=10000;//z-index;
document.onmouseup=MUp
document.onmousemove=MMove

function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
document.all(Obj).style.left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}

function MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}
}
//-- 控制层移动end of script -->
//获得焦点;
function getFocus(obj)
{
if(obj.style.zIndex!=index)
{
index = index + 2;
var idx = index;
obj.style.zIndex=idx;
//obj.nextSibling.style.zIndex=idx-1;
}
}
//查找祝福纸条
function Srch(obj)
{//alert(obj);
if(obj.style.zIndex!=index)
{
index = index + 1000;
var idx = index;
obj.style.zIndex = idx;
obj.style.width = 400;
obj.style.height = 300;
obj.style.left = 200;
obj.style.top = 200;
}
}
function ChkSrch()
{
if (SrchFrm.srchId.value == "")
{alert("\n\n\n你总得告诉我查找哪一个吧!!\n\n\n");
SrchFrm.srchId.focus();
return false; }
return true;
}

function checkNum(obj){
var checkOK = "0123456789 ";
var checkStr = obj.value;
var allValid = true;
for (i = 0; i < checkStr.length; i++){
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length){
allValid = false;
break;
}
}
if (!allValid){
alert("只能由数字组成!");
obj.select();
return (false);
}
return (true);
}
</script>
</head>

<link rel="stylesheet" href="style0930.css" type="text/css" />

<body>
<table width="100" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><img src="image/11_2.jpg" width="546" height="160" /></td>
</tr>
</table>
<br>
<table width=700 border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#F577B9">
<tr>
<td width=67 align="center" valign="middle" id="menu"><a href="index.asp">首 页</a></td>
<td width=77 align="center" valign="middle" id="menu"><a href="write.asp">发表许愿</a></td>
<td width=95 align="center" valign="middle" id="menu"><a href="wish.asp">查看许愿</a></td>
<td width="453" align="left"><span class="white"></span></td>
</tr>
</table>
<%
dim sqlseek,i
i=1
sqlseek="select * from wish"
set rsseek=server.createobject("ADODB.Recordset")
rsseek.open sqlseek,conn,1,3
if not rsseek.eof then
%>
<div id='cc29' class='Cccc' style='position:absolute; left:662px; top:283px; background-color:#E6F2E7; z-index:29; width: 162px; height: 128px;' onmousedown='getFocus(this)'>
<table width="101%" border=0><td style='cursor:move;' width='98%' onmousedown=MDown(cc29)>第<%=rsseek("id")%>条</td><td style='cursor:hand;' onclick='ssdel()' width='2%'>×</td></tr><tr><td style='height:100px;padding:5px;' colspan='2'><div style='padding:5px;'><%=rsseek("content")%></div></td></tr><tr><td><div style='padding:5px;float:right;'><%=rsseek("writer")%></div></td></tr></table></div>
<%
rsseek.movenext
end if %>
<div id="div_img"></div>
</body>
</html>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧