找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 129|回复: 8

变量问题

[复制链接]
发表于 2010-1-14 02:10:33 | 显示全部楼层 |阅读模式 IP:江苏扬州
我现在的问题是<script language="javascript" src="lnews.asp?typeid=2&n=8"></script>
这样可以出来
就是想把2换成变量cstr(newstype)不知道怎么办
发表于 2010-1-14 02:10:37 | 显示全部楼层 IP:江苏扬州
&lt;script language="javascript" src="lnews.asp?typeid=&lt;%=cstr(newstype)%&gt;&amp;n=8"&gt;&lt;/script&gt;
回复

使用道具 举报

发表于 2010-1-14 02:10:41 | 显示全部楼层 IP:江苏扬州
谢谢islet,可以了,还有个问题
这里n=8,要是想读取所有信息,怎么修改,是你n=all?把n=8去掉还是其他?
回复

使用道具 举报

发表于 2010-1-14 02:10:44 | 显示全部楼层 IP:江苏扬州
你在lnews.asp判断一下再select就行了
回复

使用道具 举报

发表于 2010-1-14 02:10:48 | 显示全部楼层 IP:江苏扬州
javastr="<table width=\"100%\" border=\"0\" height=\"0\" name=\"top01\" align=\"right\">"
<!--#include file="config.asp"-->
<%newstype=request("typeid")
n=request("n")
if newstype<> "" then
sql="select top "+cstr(n)+" typename,newsid,path,N_Fname,title from article where typeid="+cstr(newstype)+" order by dateandtime desc"
set rs=conn.execute(sql)%>
<%
do while not rs.eof
%>
<%
ntypename=rs("typename")
%>
javastr=javastr+"<tr><td width=\"5%\" height=\"0\">"
javastr=javastr+"<font color=\"#597BC3\" size=\"1\"></font>&nbsp;&nbsp;<img src=\"image/dian1.jpg\" width=\"10\" height=\"10\"></td><td height=\"0\"><span style=\"font-size:9pt;line-height: 15pt\"><a href=\"open.asp?id=<%=rs("newsid")%>&path=<%=rs("path")%>&filename=<%=rs("N_Fname")%>\") target=_blank><%=rs("title")%></span></a>"
javastr=javastr+"</td></tr>"
<%
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing%>
javastr=javastr+"</table>"
document.write (javastr)
<%else%>
document.write ("对不起,暂时没有任何内容。")
<%end if%>
这个就是lnews.asp
怎么判断?
回复

使用道具 举报

发表于 2010-1-14 02:10:53 | 显示全部楼层 IP:江苏扬州
我解决了,现在可以显示所有信息了
但是页面好像不能分页了,这个页面
<!--#include file="config.asp"-->
<!--#include file="top.htm"-->
<style type="text/css">
<!--
@import url("link.css");
@import url("text1.css");
-->
</style>
<%
const MaxPerPage=8
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim sql
dim rs
dim rstype
dim typesql
dim typeid,typename1
if not isEmpty(request("typeid")) then
typeid=request("typeid")
else
typeid=1
end if
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<%
newstype=request("typeid")
sql="select * from article where typeid="+cstr(newstype)+" order by dateandtime desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=0 width=777 borderColorLight=#ff8000 border=1 align=center>
<TBODY>
<TR>
<TD width="100%">
<TABLE cellSpacing=0 cellPadding=0 width=777 border=0>
<TBODY>
<TR>
<TD vAlign=top width=161 bgColor=#fedec0>
<TABLE cellSpacing=0 cellPadding=0 width=161 border=0>
<TBODY>
<TR>
<TD width="100%" bgColor=#fe8d3e height=25>
<P align=center>
<SCRIPT src="images/time.js"></SCRIPT>
</P></TD></TR>
<TR>
<TD vAlign=top width="100%">
 </TD></TR></TBODY></TABLE></TD>
<TD vAlign=top width=1 bgColor=#ff8000></TD>
<TD background=images/zwccc_le12.gif height=375 vAlign=top>
<br>
<TABLE cellSpacing=0 cellPadding=0 width=587 align=center border=0>
<TBODY>
<TR>
<TD><IMG height=27 src="images/0<%=rs("typeid")%>.gif"
width=450></TD></TR></TBODY></TABLE><BR>
<%
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 新 闻</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
else
currentPage=1
showContent
end if
end if
rs.close
end if

set rs=nothing
conn.close
set conn=nothing

sub showContent
dim i
i=0
%>

<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0>
<TBODY>
<TR>
<TD width=500 height=28>
<script language="javascript" src="lnews1.asp?typeid=<%=cstr(newstype)%>"></script> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0>
<TBODY>
<TR>
<TD width=500 background=images/dian1.gif
height=5></TD></TR></TBODY></TABLE>
<%
end sub
%>
<center>
<%
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
if CurrentPage<2 then
response.write "<fontdisabled bgcolor=#93BEE2>首页 上一页</font> "
else
response.write "<a href="&filename&"?typename="&(request("typename"))&"&page=1&typeid="&typeid&" class=line>首页</a> "
response.write "<a href="&filename&"?typename="&(request("typename"))&"&page="&CurrentPage-1&"&typeid="&typeid&" class=line>上一页</a> "
end if
if n-currentpage<1 then
response.write "<font bgcolor=#93BEE2>下一页 尾页</font>"
else
response.write "<a href="&filename&"?typename="&(request("typename"))&"&page="&(CurrentPage+1)&"&typeid="&typeid&" class=line>"
response.write "下一页</a> <a href="&filename&"?typename="&(request("typename"))&"&page="&n&"&typeid="&typeid&" class=line>尾页</a>"
end if
response.write "<font bgcolor=#93BEE2> 共</font><strong><font bgcolor=#93BEE2>"&n&"</strong>页</font> "
response.write "<font bgcolor=#93BEE2> 共<b>"&totalnumber&"</b>条信息<b>"
end function
%><% showpage totalput,MaxPerPage,"list.asp"%>
</center>
</TD></TR></TBODY></TABLE>
</td></td>
</table>
<!---->
</BODY></HTML><!--#include file="bottom.htm"-->
回复

使用道具 举报

发表于 2010-1-14 02:10:57 | 显示全部楼层 IP:江苏扬州
if n="" or (not isnumeric(n)) then
sql="select typename ……
else
sql="select top "+cstr(n)+" typename ……
end if
回复

使用道具 举报

发表于 2010-1-14 02:11:01 | 显示全部楼层 IP:江苏扬州
知道了,谢谢islet,问题是现在这个页面分页有问题,设定了每页显示最多8个记录,可记录全部显示了出来,怎么修改啊?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 07:20 , Processed in 0.132871 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表