網(wǎng)頁經(jīng)典代碼(四)
22.網(wǎng)頁不會被緩存
HTMl網(wǎng)頁
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
或者<META HTTP-EQUIV="expires" CONTENT="0">
ASP網(wǎng)頁
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
PHP網(wǎng)頁
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
23. 定義數(shù)據(jù)庫連接的一些常量
<%
'定義數(shù)據(jù)庫連接的一些常量
Const adOpenForwardOnly = 0 '游標(biāo)只向前瀏覽記錄,不支持分頁、Recordset、
BookMark
Const adOpenKeyset = 1 '鍵集游標(biāo),其他用戶對記錄說做的修改將反映到記
錄集中,但其他用戶增加或刪除記錄不會反映到記錄集中。支持分頁、Recordset、Boo
kMark
Const adOpenDynamic = 2 '動態(tài)游標(biāo)功能最強(qiáng),但耗資源也最多。用戶對記錄
說做的修改,增加或刪除記錄都將反映到記錄集中。支持全功能瀏覽(ACCESS不支持)。
Const adOpenStatic = 3 '靜態(tài)游標(biāo),只是數(shù)據(jù)的一個(gè)快照,用戶對記錄說做
的修改,增加或刪除記錄都不會反映到記錄集中。支持向前或向后移動
Const adLockReadOnly = 1 '鎖定類型,默認(rèn)的,只讀,不能作任何修改
Const adLockPessimistic = 2 '當(dāng)編輯時(shí)立即鎖定記錄,最安全的方式
Const adLockOptimistic = 3 '只有在調(diào)用Update方法時(shí)才鎖定記錄集,而在此前
的其他操作仍可對當(dāng)前記錄進(jìn)行更改、插入和刪除等
Const adLockBatchOptimistic = 4 '當(dāng)編輯時(shí)記錄不會被鎖定,而更改、插入和刪除是
在批處理方式下完成的
Const adCmdText = &H0001
Const adCmdTable = &H0002
%>
24.最小化、最大化、關(guān)閉窗口
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" value="Close"></OBJECT>
<input type=button value=最小化 onclick=hh1.Click()>
<input type=button value=最大化 onclick=hh2.Click()>
<input type=button value=關(guān)閉 onclick=hh3.Click()>
說明:本例適用于IE
25.判斷上一頁的來源
asp頁:
request.servervariables("HTTP_REFERER")
javascript:
document.referrer
26.光標(biāo)是停在文本框文字的最后
<script language="javascript">
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart('character',e.value.length);
r.collapse(true);
r.select();
}
</script>
<input type=text name=text1 value="123" >
說明:適用于表格數(shù)據(jù)提交
如果轉(zhuǎn)萜,請注明轉(zhuǎn)自-=e代時(shí)光=- http://www.e3i5.com
27.怎樣通過asp的手段來檢查來訪者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通過了代理服務(wù)器,"& _
"真實(shí)的IP為"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>
28.取得控件的絕對位置
<script language="javascript">
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+"/nleft="+l);
}
</script>
file://VBScript
<script language="VBScript"><!--
function getIE()
dim t,l,a,b
set a=document.all.img1
t=document.all.img1.offsetTop
l=document.all.img1.offsetLeft
while a.tagName<>"BODY"
set a = a.offsetParent
t=t+a.offsetTop
l=l+a.offsetLeft
wend
msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
end function
--></script>
說明:本例適用于JS
網(wǎng)頁經(jīng)典代碼(二)
29.滾動特效
<marquee scrollamount="2
" scrolldelay="0" direction="up" width="330" height="120" border="0" align="
center" id="MARQUEE1">
<p>歡迎光臨陽春學(xué)生網(wǎng)
我們地址是http://www.ycuu.net
感謝
</marquee>
|
新聞熱點(diǎn)
疑難解答
圖片精選