獲得系統時間:
<%=now()%>
取得來訪用的IP:
<%=requestserverVariables(\remote_host\)%>
獲得系統浏覽器版本:
<script>
windowdocumentwrite(\版本\+navigatorappName+navigatorappVersion+\ browser\)
</script>
去除IE混動條:
<body scroll=\no\>
<body style=\overflowy:hidden\>
進入網站跳出廣告:
<script language=\javascript\>
<!
<! 注意更改文件所在路徑>
windowopen(\\\\\height=width=top=left=\);
// >
</script>
隨機數:
<%randomize%>
<%=(int(rnd()*n)+)%>
N為可改變數
向上混動代碼:
<marquee direction=\up\ scrolldelay=\\ style=\fontsize: pt; color: #FF; lineheight: %; fontstyle:italic; fontweight:bold\ scrollamount=\\ width=\\ height=\\ bgcolor=\#FFFF\>hhhhhhhhhhhhhhhhhhh</marquee>
自動關閉網頁:
<script LANGUAGE=\javascript\>
<!
setTimeout(\windowclose();\ ); //秒後關閉
// >
</script>
<p align=\center\>本頁秒後自動關閉請注意刷新頁面</p>
隨機背景音樂:
<%randomize%>
<bgsound src=\mids/<%=(int(rnd()*)+)%>mid\ loop=\\>
可以修改數字限制調用個數我這裡是60個.
自動刷新本頁面:
<script>
<!
var limit=\:\
if (documentimages){
var parselimit=limitsplit(\:\)
parselimit=parselimit[]*+parselimit[]*
}
function beginrefresh(){
if (!documentimages)
return
if (parselimit==)
windowlocationreload()
else{
parselimit=
curmin=Mathfloor(parselimit/)
cursec=parselimit%
if (curmin!=)
curtime=curmin+\分\+cursec+\秒後重刷本頁!\
else
curtime=cursec+\秒後重刷本頁!\
windowstatus=curtime
setTimeout(\beginrefresh()\)
}
}
windowonload=beginrefresh
file://>
</script>
ACCESS數據庫連接:
<%
option explicit
dim startimeendtimeconnconnstrdb
startime=timer()
\更改數據庫名字
db=\data/dvBBSmdb\
Set conn = ServerCreateObject(\ADODBConnection\)
connstr=\Provider=MicrosoftJetOLEDB;Data Source=\ & ServerMapPath(db)
\如果你的服務器采用較老版本Access驅動請用下面連接方法
\connstr=\driver={Microsoft Access Driver (*mdb)};dbq=\ & ServerMapPath(db)
connOpen connstr
function CloseDatabase
Connclose
Set conn = Nothing
End Function
%>
SQL數據庫連接:
<%
option explicit
dim startimeendtimeconnconnstrdb
startime=timer()
connstr=\driver={SQL Server};server=HUDENQNTNB;uid=sa;pwd=xsfeihu;database=dvbbs\
Set conn = ServerCreateObject(\ADODBConnection\)
connOpen connstr
function CloseDatabase
Connclose
Set conn = Nothing
End Function
%>
用鍵盤打開網頁代碼:
<script language=\javascript\>
function ctlent(eventobject)
{
if((eventctrlKey && windoweventkeyCode==)||(eventaltKey && windoweventkeyCode==))
{
windowopen(\網址\\\\\)
}
}
</script>
這裡是Ctrl+Enter和Alt+S的代碼 自己查下鍵盤的ASCII碼再換就行
讓層不被控件復蓋代碼:
<div zIndex:><object xxx></object></div> # 前面
<div zIndex:><object xxx></object></div> # 後面
<div id=\Layer\ style=\position:absolute; top:;width:px; height:px;zindex:\><table height=% width=% bgcolor=\#ff\><tr><td height=% width=%></td></tr></table><iframe width= height=></iframe></div>
<div id=\Layer\ style=\position:absolute; top:;width:px; height:px;zindex:\><iframe height=% width=%></iframe></div>
動網FLASH廣告代碼:
<object classid=\clsid:DCDBEAEDcfB\ codebase=\#version=\ width=\\ height=\\><param name=movie value=\images/yjdswf\><param name=quality value=high><embed src=\//swf\ quality=high pluginspage=\_Prod_Version=ShockwaveFlash\;;;;;;;;;;;; type=\application/xshockwaveflash\ width=\\ height=\\></embed></object>
VBS彈出窗口小代碼:
<script language=vbscript>
msgbox\你還沒有注冊或登陸論壇\\\\精品論壇
\
location
href = \
login
asp\
</script>
使用FSO修改文件特定內容的函數
function FSOchange(filename
Target
String)
Dim objFSO
objCountFile
FiletempData
Set objFSO = Server
CreateObject(\
Scripting
FileSystemObject\
)
Set objCountFile = objFSO
OpenTextFile(Server
MapPath(filename)
True)
FiletempData = objCountFile
ReadAll
objCountFile
Close
FiletempData=Replace(FiletempData
Target
String)
Set objCountFile=objFSO
CreateTextFile(Server
MapPath(filename)
True)
objCountFile
Write FiletempData
objCountFile
Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function
使用FSO讀取文件內容的函數
function FSOFileRead(filename)
Dim objFSO
objCountFile
FiletempData
Set objFSO = Server
CreateObject(\
Scripting
FileSystemObject\
)
Set objCountFile = objFSO
OpenTextFile(Server
MapPath(filename)
True)
FSOFileRead = objCountFile
ReadAll
objCountFile
Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function
使用FSO讀取文件某一行的函數
function FSOlinedit(filename
lineNum)
if linenum <
then exit function
dim fso
f
temparray
tempcnt
set fso = server
CreateObject(\
scripting
filesystemobject\
)
if not fso
fileExists(server
mappath(filename)) then exit function
set f = fso
opentextfile(server
mappath(filename)
)
if not f
AtEndofStream then
tempcnt = f
readall
f
close
set f = nothing
temparray = split(tempcnt
chr(
)&chr(
))
if lineNum>ubound(temparray)+
then
exit function
else
FSOlinedit = temparray(lineNum
)
end if
end if
end function
使用FSO寫文件某一行的函數
function FSOlinewrite(filename
lineNum
Linecontent)
if linenum <
then exit function
dim fso
f
temparray
tempCnt
set fso = server
CreateObject(\
scripting
filesystemobject\
)
if not fso
fileExists(server
mappath(filename)) then exit function
set f = fso
opentextfile(server
mappath(filename)
)
if not f
AtEndofStream then
tempcnt = f
readall
f
close
temparray = split(tempcnt
chr(
)&chr(
))
if lineNum>ubound(temparray)+
then
exit function
else
temparray(lineNum
) = lineContent
end if
tempcnt = join(temparray
chr(
)&chr(
))
set f = fso
createtextfile(server
mappath(filename)
true)
f
write tempcnt
end if
f
close
set f = nothing
end function
使用FSO添加文件新行的函數
function FSOappline(filename
Linecontent)
dim fso
f
set fso = server
CreateObject(\
scripting
filesystemobject\
)
if not fso
fileExists(server
mappath(filename)) then exit function
set f = fso
opentextfile(server
mappath(filename)
)
f
write chr(
)&chr(
)&Linecontent
f
close
set f = nothing
end function
讀文件最後一行的函數
function FSOlastline(filename)
dim fso
f
temparray
tempcnt
set fso = server
CreateObject(\
scripting
filesystemobject\
)
if not fso
fileExists(server
mappath(filename)) then exit function
set f = fso
opentextfile(server
mappath(filename)
)
if not f
AtEndofStream then
tempcnt = f
readall
f
close
set f = nothing
temparray = split(tempcnt
chr(
)&chr(
))
FSOlastline = temparray(ubound(temparray))
end if
end function
From:http://tw.wingwit.com/Article/program/net/201311/12439.html