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

请教用什么方法可以把这些相同的代码放在另一个文件里,然后在小弟我的分页时调用就可以了?

2013-04-12 
请问用什么方法可以把这些相同的代码放在另一个文件里,然后在我的分页时调用就可以了????%if rs.pagecoun

请问用什么方法可以把这些相同的代码放在另一个文件里,然后在我的分页时调用就可以了????
<%if rs.pagecount > 0 then%>
     当前页<%=intpage%>/<%=rs.PageCount%>
     <%else%>
     当前页0/0
 <%end if%>
     <a href="?page=1<%if request("step")="lei" then%>&step=lei<%end if%><%if request("step")="leimod" then%>&step=leimod<%end if%><%if request("fid")<>"" then%>&fid=<%=request("fid")%><%end if%><%if request("ceng")<>"" then%>&ceng=<%=request("ceng")%><%end if%><%if request("mc")<>"" then%>&mc=<%=request("mc")%><%end if%><%if request("id")<>"" then%>&id=<%=request("id")%><%end if%><%if request("step1")="so" then%>&step1=so<%end if%>">首页</a> | 
     <%if pre then%>
     <a href="?page=<%=intpage -1%><%if request("step")="lei" then%>&step=lei<%end if%><%if request("step")="leimod" then%>&step=leimod<%end if%><%if request("fid")<>"" then%>&fid=<%=request("fid")%><%end if%><%if request("ceng")<>"" then%>&ceng=<%=request("ceng")%><%end if%><%if request("mc")<>"" then%>&mc=<%=request("mc")%><%end if%><%if request("id")<>"" then%>&id=<%=request("id")%><%end if%><%if request("step1")="so" then%>&step1=so<%end if%>">上一页</a> | <%end if%>
     <%if last then%>
     <a href="?page=<%=intpage +1%><%if request("step")="lei" then%>&step=lei<%end if%><%if request("step")="leimod" then%>&step=leimod<%end if%><%if request("fid")<>"" then%>&fid=<%=request("fid")%><%end if%><%if request("ceng")<>"" then%>&ceng=<%=request("ceng")%><%end if%><%if request("mc")<>"" then%>&mc=<%=request("mc")%><%end if%><%if request("id")<>"" then%>&id=<%=request("id")%><%end if%><%if request("step1")="so" then%>&step1=so<%end if%>">下一页</a> |<%end if%>
 
     <a href="?page=<%=rs.PageCount%><%if request("step")="lei" then%>&step=lei<%end if%><%if request("step")="leimod" then%>&step=leimod<%end if%><%if request("fid")<>"" then%>&fid=<%=request("fid")%><%end if%><%if request("ceng")<>"" then%>&ceng=<%=request("ceng")%><%end if%><%if request("mc")<>"" then%>&mc=<%=request("mc")%><%end if%><%if request("id")<>"" then%>&id=<%=request("id")%><%end if%><%if request("step1")="so" then%>&step1=so<%end if%>">尾页</a> | 转到第
      <select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
      <%
       for i = 1 to rs.PageCount


       if i = intpage then%>
       <option value="?page=<%=i%><%if request("step")="lei" then%>&step=lei<%end if%><%if request("step")="leimod" then%>&step=leimod<%end if%><%if request("fid")<>"" then%>&fid=<%=request("fid")%><%end if%><%if request("ceng")<>"" then%>&ceng=<%=request("ceng")%><%end if%><%if request("mc")<>"" then%>&mc=<%=request("mc")%><%end if%><%if request("id")<>"" then%>&id=<%=request("id")%><%end if%><%if request("step1")="so" then%>&step1=so<%end if%>" selected><%=i%></option>
     <%else%>
       <option value="?page=<%=i%><%if request("step")="lei" then%>&step=lei<%end if%><%if request("step")="leimod" then%>&step=leimod<%end if%><%if request("fid")<>"" then%>&fid=<%=request("fid")%><%end if%><%if request("ceng")<>"" then%>&ceng=<%=request("ceng")%><%end if%><%if request("mc")<>"" then%>&mc=<%=request("mc")%><%end if%><%if request("id")<>"" then%>&id=<%=request("id")%><%end if%><%if request("step1")="so" then%>&step1=so<%end if%>"><%=i%></option>
        <%
          end if
        next
        %>
     </select> 页 共<%=rs.recordcount%>条记录


上面代码中红色部分是相同的代码:<%if request("step")="lei" then%>&step=lei<%end if%><%if request("step")="leimod" then%>&step=leimod<%end if%><%if request("fid")<>"" then%>&fid=<%=request("fid")%><%end if%><%if request("ceng")<>"" then%>&ceng=<%=request("ceng")%><%end if%><%if request("mc")<>"" then%>&mc=<%=request("mc")%><%end if%><%if request("id")<>"" then%>&id=<%=request("id")%><%end if%><%if request("step1")="so" then%>&step1=so<%end if%>
请问用什么方法可以把这些相同的代码放在另一个文件里,然后在我的分页时调用就可以了????

你完全可以把这些单独提出来啊,你这样写的话,参数多了,累死你

<%
dim url 
url = "&step="&request("step")&"&fid="&request("fid")&""
%>

热点排行
Bad Request.