萬盛學電腦網

 萬盛學電腦網 >> 網頁制作 >> 腳本Html教程 >> html頁面中常用的一些小方法整理

html頁面中常用的一些小方法整理

在<Head>標簽中加

<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 1978 08:21:57 GMT ">

如何用JQuery的ajax跳轉,可以這樣清理

//ajax請求不緩存

$.ajaxSetup({ cache: false
});

MaintainScrollPositionOnPostback="true"
如內容超出單元格,則隱藏
style="TABLE-LAYOUT: fixed"

讓彈出窗口總是在最上面: <body onblur="this.focus();">
不要滾動條? 讓豎條沒有: <body style='overflow:scroll;overflow-y:hidden'> </body>
讓橫條沒有: <body style='overflow:scroll;overflow-x:hidden'> </body>
兩個都去掉?更簡單了 <body scroll="no"> </body>
怎樣去掉圖片鏈接點擊後,圖片周圍的虛線? <a href="#" onFocus="this.blur()"><img src="logo.jpg" border=0></a>
電子郵件處理提交表單 <form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain">

<input type=submit> </form>
在打開的子窗口刷新父窗口的代碼裡如何寫? window.opener.location.reload()
如何設定打開頁面的大小 <body onload="top.resizeTo(300,200);">
在 頁面中如何加入不是滿鋪的背景圖片,拉動頁面時背景圖不動 <html><head> <STYLE> body {background-image:url(logo.gif); background-repeat:no-repeat; background-position:center } </STYLE> </head> <body bgproperties="fixed" > </body> </html>

各種樣式的光標 auto :標准光標
default :標准箭頭
hand :手形光標
wait :等待光標
text :I形光標
vertical-text :水平I形光標
no-drop :不可拖動光標
not-allowed :無效光標
help :?幫助光標
all-scroll :三角方向標
move :移動標
crosshair :十字標 e-resize n-resize nw-resize w-resize s-resize se-resize sw-resize

本機ip<%=request.servervariables("remote_addr")%>
服務器名<%=Request.ServerVariables("SERVER_NAME")%>
服務器IP<%=Request.ServerVariables("LOCAL_ADDR")%>
服務器端口<%=Request.ServerVariables("SERVER_PORT")%>
服務器時間<%=now%> IIS
版本<%=Request.ServerVariables"SERVER_SOFTWARE")%>
腳本超時時間<%=Server.ScriptTimeout%>
本文件路徑<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%>
服務器CPU數量<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>
服務器解譯引擎<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion

&"."& ScriptEngineBuildVersion %>
服務器操作系統<%=Request.ServerVariables("OS")%>

文本豎排方式
<style type="text/css">
<!--
.shupai {Writing-mode:tb-rl}
-->
</style>
超鏈接去虛線邊框
在鏈接中加上onfocus="this.blur()"

網頁搜索關鍵字 頭裡插入
<META NAME="keywords" CONTENT="xxxx,xxxx,xxx,xxxxx,xxxx,">

收藏夾圖標
<link rel = "Shortcut Icon" href="favicon.ico">

我的電腦
file:///::%7B20D04FE0-3AEA-1069-A2D8-08002B30309D}
網上鄰居
file:///::%7B208D2C60-3AEA-1069-A2D7-08002B30309D%7D
我的文檔
file:///::%7B450D8FBA-AD25-11D0-98A8-0800361B1103%7D
控制面板
file:///::%7B20D04FE0-3AEA-1069-A2D8-08002B30309D%7D/::%7B21EC2020-3AEA-1069-A2DD-08002B30309D}
回收站
file:///::%7B645FF040-5081-101B-9F08-00AA002F954E%7D

鼠標控制圖片隱現效果
把如下代碼加入<body>區域中:
<SCRIPT language="javascript">
<!--
function makevisible(cur,which){
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=20
}
//-->
</SCRIPT>
2、把如下代碼加入<body>區域中:
<img src="2.gif" style="filter:alpha(opacity=20)"
onMouseOver="makevisible(this,0)"
onMouseOut="makevisible(this,1)">

禁止圖片下載
<A HREF="javascript:void(0)" onMouseover="alert('對不起,此圖片不能下載!')">
<IMG SRC="2.gif" Align="center" Border="0" width="99" height="50"></A>

頁嵌頁
<iframe width=291 height=247 src="main.files/news.htm" frameBorder=0></iframe>

隱藏滾動條
<body style="overflow-x:hidden;overflow-y:hidden"

CSS文字陰影(定義在<TD>中)
.abc{
FILTER: dropshadow(color=#666666, offx=1, offy=1, positive=1); FONT-FAMILY: "宋體"; FONT-SIZE: 9pt;COLOR: #ffffff;
}

列表/菜單
onchange="location=this.options[this.selectedIndex].value"

<iframe id="frm" src="k-xinwen.html" scrolling="no" width="314" height="179"></iframe>
<img src="xiangshang.jpg" onMouseOver="sf=setInterval('frm.scrollBy(0,-2)',1)" onMouseOut="clearInterval(sf)" width="31" height="31">
<img src="xiangxia.jpg" onMouseOver="sf=setInterval('frm.scrollBy(0,2)',1)" onMouseOut="clearInterval(sf)" width="31" height="31" >

reurl=server.htmlencode(request.ServerVariables("HTTP_REFERER"))

服務器上如何定義連接
MM_www_STRING ="driver={Microsoft access Driver (*.mdb)};dbq=" & server.mappath("../data/www.mdb")

鏈接到
response.redirect"login.asp"
location.href="xx.asp"

onClick="window.location='login.asp'"
onClick="window.open('')"

取得IP
userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")

sql="update feedbak set hit=hit+1 where id="&request("id")
conn.execute(sql)

截取字符是否加...
function formatStr(str,len)
if(len(str)>len)
str = left(str,len) + "..."
end if
formatStr = str
end function

接收表單
If Ucase(Request.ServerVariables("REQUEST_METHOD")) = "POST" then
end if


圖片寬度
<script language="javascript">
<!--
var flag=false;
function DrawImage(ckp){
var image=new Image();
image.src=ckp.src;
if(image.width>0 && image.height>0)
{flag=true;
if(image.width>120){
ckp.width=120;
}else{
ckp.width=image.width;
}
ckp.alt=image.width+"×"+image.height;
}
}
//-->
</script>
I'll be Back 22:18:06
<img src="<%=formPath%>/<%=rs("photoname")%>" border="0" onload="javascript:DrawImage(this);">

跳轉
<meta http-equiv=refresh content='0; url=/distributor

copyright © 萬盛學電腦網 all rights reserved