整理了一些ASP初學者常用的代碼
來源:互聯網
上載者:User
1.獲得系統時間:
<%=now()%>
2.取得來訪用的IP:
<%=request.serverVariables("remote_host")%>
3.獲得系統,瀏覽器版本:
<script>
window.document.write("版本:"+navigator.appName+navigator.appVersion+" browser.")
</script>
4.去除IE混動條:
<body scroll="no">
<body style="overflow-y:hidden">
5.進入網站,跳出廣告:
<script language="javascript">
<!--
<!-- 注意變更檔所在路徑-->
window.open(''http://www.XXXXXX.com'','''',''height=200,width=300,top=0,left=30'');
// -->
</script>
6.隨機數:
<%randomize%>
<%=(int(rnd()*n)+1)%>
N為可改變數
7.向上混動代碼:
<marquee direction="up" scrolldelay="200" style="font-size: 9pt; color: #FF0000; line-height: 150%; font-style:italic; font-weight:bold" scrollamount="2" width="206" height="207" bgcolor="#FFFF00">hhhhhhhhhhhhhhhhhhh</marquee>
8.自動關閉網頁:
<script LANGUAGE="javascript">
<!--
setTimeout(''window.close();'', 10000); //60秒後關閉
// -->
</script>
<p align="center">本頁10秒後自動關閉,請注意重新整理頁面</p>
9.隨機背景音樂:
<%randomize%>
<bgsound src="mids/<%=(int(rnd()*60)+1)%>.mid" loop="-1">
可以修改數字,限制調用個數,我這裡是60個.
10.自動重新整理本頁面:
<script>
<!--
var limit="0:10"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60