推薦:學(xué)ASp動(dòng)態(tài)網(wǎng)頁(yè)必備:常用的38個(gè)函數(shù)1.函數(shù)array()
功能:創(chuàng)建一個(gè)數(shù)組變量
格式:array(list)
參數(shù):list 為數(shù)組變量中的每個(gè)數(shù)值列,中間用逗號(hào)間隔
例子:
<% i = array ("1","2","3&quo
由于本人的空間收到限制,不能一次批量生成所有的靜態(tài)頁(yè),所以自己寫(xiě)了一個(gè)小程序和大家分享,程序相當(dāng)簡(jiǎn)單,高手莫要見(jiàn)笑!此代碼就是很浪費(fèi)時(shí)間.代碼如下
|
<!--#include file="conn.asp"--> <HTML><HEAD><TITLE>生成頁(yè)面</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> <LINK href="style.css" type=text/css rel=stylesheet> <META content="MSHTML 6.00.2900.3020" name=GENERATOR> </HEAD> <BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0> <BR style="OVERFLOW: hidden; LINE-HEIGHT: 3px"> <% dim id id=cint(request.querystring("id")) if id="" then id="1" else id=cint(request.querystring("id")) end if
Dim totalnumber sql="select id from table order by id DESC" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 rs.Movefirst if not rs.eof then TotalNumber=rs.recordcount end if 獲取總數(shù)可以用一句代碼代替,這個(gè)相信朋友自己可以解決. rs.close set rs=nothing
Response.Write "<br><br>" & vbNewLine Response.Write "<table width='400' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbNewLine Response.Write " <tr>" & vbNewLine Response.Write " <td height='50'>總共 <font color='blue'><b>" & totalnumber & "</b></font> 個(gè)頁(yè)面,正在生成第 <font color='red'><b>" & ID & "</b></font> 個(gè)頁(yè)面…… </td>" & vbNewLine Response.Write " </tr>" & vbNewLine Response.Write "</table>" & vbNewLine Response.Flush
If ID > totalnumber Then Response.Write "恭喜您操作成功!" Response.Flush End If
creat(ID) id=id 1 Response.Write "<meta http-equiv=""refresh"" content=""1;url=?ID="&id&""">" %> </BODY> </HTML>
<% Function creat(id) sql="SELECT * from table where id="&ID set rs=conn.execute(sql) dim name name=rs("name") conn.execute(sql) rs.close set rs=nothing dim fso dim znwl dim art dim fw set fso=createobject("scripting.filesystemobject") set znwl=fso.opentextfile(server.mappath("模板頁(yè)")) art=znwl.readall znwl.close
art=replace(art,"{$name$}",name) set fw=fso.createtextfile(server.mappath("生成頁(yè)存放位置及頁(yè)面名稱"),true) fw.writeline art fw.close set fso=nothing End Function %>
|
另外還有一種方法比上面的方法快,但是占用CPU比較多,我的空間用下面的方法老出問(wèn)題
|
<!--#include file="conn.asp"--> <HTML><HEAD><TITLE>生成頁(yè)面</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> <LINK href="style.css" type=text/css rel=stylesheet> <META content="MSHTML 6.00.2900.3020" name=GENERATOR> </HEAD> <BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0> <BR style="OVERFLOW: hidden; LINE-HEIGHT: 3px"> <table border="1" width="100%" id="table1"> <tr> <td> <% dim allid,ppp,id,totalnum sql="select * from table order by id DESC" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 if not rs.eof then do while not rs.eof if allid="" then allid= rs("id") else allid= allid & ";" & rs("id") rs.movenext loop else If Rs.bof And Rs.EOF Then Response.Write "還沒(méi)有找到任何文章!" End if end if rs.close set rs=nothing
allid=";" allid ppp=split(allid,";") totalnum=ubound(ppp) for id=1 to totalnum Session("id")=Session("id") 1 creat(id) response.write "正在生成znwl_"&id&".htm...<br>" next %> </td> </tr> </table> </BODY> </HTML>
<% Function creat(id) sql="SELECT * from table where id="&ID set rs=conn.execute(sql) dim name name=rs("name") conn.execute(sql) rs.close set rs=nothing dim fso dim znwl dim art dim fw set fso=createobject("scripting.filesystemobject") set znwl=fso.opentextfile(server.mappath("模板頁(yè)")) art=znwl.readall znwl.close %>
art=replace(art,"{$name$}",name) set fw=fso.createtextfile(server.mappath("生成頁(yè)存放位置及頁(yè)面名稱"),true) fw.writeline art fw.close set fso=nothing End Function
|
這種方法快,但是你的空間要不受限制!--智能網(wǎng)絡(luò)
上面的方法僅供參考,并不是本人修改的最后版本,但是絕對(duì)好用.
分享:ASP技巧實(shí)例:幾行代碼解決防止表單重復(fù)提交在很多情況下都需要防止相同的表單被多次提交,很多人的實(shí)現(xiàn)方法都比較復(fù)雜(代碼數(shù)量超過(guò)幾十行��!)下面提供一種只需使用幾行代碼的方法,輕松地實(shí)現(xiàn)了防止用戶刷新多次提交表單和使用后退鈕重