DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML和Xhtml >> html頁面中常用的一些小方法整理
html頁面中常用的一些小方法整理
編輯:HTML和Xhtml     
在<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/distributor.aspx'>

溢出欄的設制
visible:超出的部分照樣顯示;
hidden:超出的部分隱藏;
scrool:不管有否超出,都顯示滾動條;
auto:有超出時才出現滾動條;

onMouseOver:鼠標移到目標上;
onMouseUp:按下鼠標再放開左鍵時;
onMouseOut:鼠標移開時;
onMouseDown:按下鼠標時(不需要放開左鍵);
onClink:點擊時;
onDblClick:雙擊時;
onLoad:載入網頁時;
onUnload:離開頁面時;
onResize:當浏覽者改變浏覽窗口的大小時;
onScroll:當浏覽者拖動滾動條的時。

CSS樣式
a:link:表示已經鏈接;
a:hover:表示鼠標移上鏈接時;
a:active:表示鏈接激活時;
a:visited:表示己點擊過的鏈接。

跳出對話框鏈接
javascript:alert('lajflsjpjwg')
後退:javascript:history.back(1)
關閉窗口:javascript:window.close();
窗口還原
function restore(){
window.moveTo(8,8);
window.resizeTo(screen.width-24,screen.availHeight-24);
}

head區是指首頁HTML代碼的<head>和</head>之間的內容。
必須加入的標簽

1.公司版權注釋
<!--- The site is designed by Maketown,Inc 06/2000 --->

2.網頁顯示字符集
簡體中文:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
繁體中文:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=BIG5">
英 語:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

3.網頁制作者信息
<META name="author" content="[email protected]">

4.網站簡介
<META NAME="DESCRIPTION" CONTENT="xxxxxxxxxxxxxxxxxxxxxxxxxx">

5.搜索關鍵字
<META NAME="keywords" CONTENT="xxxx,xxxx,xxx,xxxxx,xxxx,">

6.網頁的css規范
<LINK href="style/style.css" rel="stylesheet" type="text/css">
(參見目錄及命名規范)

7.網頁標題
<title>xxxxxxxxxxxxxxxxxx</title>

.可以選擇加入的標簽

1.設定網頁的到期時間。一旦網頁過期,必須到服務器上重新調閱。
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">

2.禁止浏覽器從本地機的緩存中調閱頁面內容。
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

3.用來防止別人在框架裡調用你的頁面。
<META HTTP-EQUIV="Window-target" CONTENT="_top">

4.自動跳轉。
<META HTTP-EQUIV="Refresh" CONTENT="5;URL=http://www.yahoo.com">
5指時間停留5秒。

5.網頁搜索機器人向導.用來告訴搜索機器人哪些頁面需要索引,哪些頁面不需要索引。
<META NAME="robots" CONTENT="none">
CONTENT的參數有all,none,index,noindex,follow,nofollow。默認是all。

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

所有的javascript的調用盡量采取外部調用.
<SCRIPT LANGUAGE="javascript" SRC="script/xxxxx.js"></SCRIPT>

附<body>標簽:
<body>標簽不屬於head區,這裡強調一下,為了保證浏覽器的兼容性,必須設置頁面背景<body bgcolor="#FFFFFF">

flash透明
在flash的源代碼中加上:<param name="wmode" value="transparent">

表格透明
style="FILTER: alpha(opacity=72)"

網址前添加icon的方法
1、上http://www.favicon.com/上用他的icon editor online制作一個圖標。他會將做好的圖標通過email即時發送給你。
2、把這個命名為favicon.ico的圖標放置在index.html同一個文件夾中。就可以了。
作一個圖標文件,大小為16*16像素。文件擴展名為ico,然後上傳到相應目錄中。在HTML源文件“<head></head>”之間添加如下代碼:
<Link Rel="SHORTCUT ICON" href="http://圖片的地址(注意與剛才的目錄對應)">
其中的“SHORTCUT ICON”即為該圖標的名稱。當然如果用戶使用IE5或以上版本浏覽時,就更簡單了,只需將圖片上傳到網站根目錄下,自動識別

可以在收藏夾中顯示出你的圖標<link rel="Bookmark" href="favicon.ico">

狀態欄連接說明
<A HREF="鏈接到某處" onmouseOver="window.status='連接說明';return true;" onMouseOut="window.status=' ';">某某鏈接</a>

鏈接說明
<a href=“”Title=鏈接說明>

禁止鼠標右鍵
在<body>標簽中加入 <body oncontextmenu="return false">

DW裡輸入空格
插入N個&nbsp;

水平線
<hr width="長度" size="高度" color="顏色代碼" noshade> noshade為有無陰影

表單電子郵件提交
< form name="content" method="post" action="mailto:電子郵箱" >< /form>
文本域名為Subject 為郵件的標題

郵件鏈接定制
Mailto:地址 ? Subject=郵件的標題 &bc=抄送 &bcc=密件抄送

背景音樂
<bgsound src=地址 loop="-1">

禁止頁面正文選取
<body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false"

onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()">

消除ie6自動出現的圖像工具欄,設置 GALLERYIMG屬性為false或no .
<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">

防止點擊空鏈接時,頁面往往重置到頁首端。
代碼“javascript:void(null)”代替原來的“#”標記

如何避免別人把你的網頁放在框架中
<script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>

頁面定時刷新
<meta http-equiv="Refresh" content="秒" >

頁面定時轉向新的地址
<meta http-equiv="refresh" content="秒;URL=url">

顯示日期
<script language="javascript"><!--
today=new Date();
var week; var date;
if(today.getDay()==0) week="星期日"
if(today.getDay()==1) week="星期一"
if(today.getDay()==2) week="星期二"
if(today.getDay()==3) week="星期三"
if(today.getDay()==4) week="星期四"
if(today.getDay()==5) week="星期五"
if(today.getDay()==6) week="星期六"
date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "
document.write("<span style='font-size: 9pt;'>"+date+week+"</span>");
// -->
</script>

設為首頁
<A href=# onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('url');">設為首頁</A>

添加收藏
<A href="javascript:window.external.AddFavorite('url','title')">收藏本站</A>

文字滾動
插入邊框為0的1行1列的表格,在表格中輸入文字,選中文字,
按ctrl+t輸入marquee direction="up", 回車即可讓文字在表格區域內向上滾動。
(right、down可用於讓文字或圖象向右及向下滾動,修改html原代碼還可以得到需要的滾動速度。


表單驗正
<SCRIPT language=javascript>
function checkform(theform){
if(theform.name.value==""){
alert("姓名不能為空!");
theform.name.focus();
return false;
}
if(theform.tel.value==""){
alert("電話不能為空!");
theform.tel.focus();
return false;
}
}
</SCRIPT>

定義鼠標
body{cursor: url(cur.ani或cur);}

以圖片方式插視頻
<IMG height=240 loop=infinite dynsrc=http://amedia.efu.com.cn/EFUADD0001.rmvb width=320>

層在flash上面
< param name="wmode" value="opaque" >

延遲跳轉
<meta http-equiv=refresh content='3; url=javascript:window.close();'>

導航條變色:
單元格<TR後面插入onmouseover="javascript:this.bgColor='#57AE00'" onmouseout="javascript:this.bgColor='#99CCFF'"

居中
<CENTER></CENTER>

空鏈接
javascript:;

標題表格
<fieldset>
<legend>表格的說明</legend>
</fieldset>

細線表格
style="BORDER-COLLAPSE: collapse;"

滾動條顏色代碼
BODY{
SCROLLBAR-FACE-COLOR: #FFFFFF;
SCROLLBAR-HIGHLIGHT-COLOR: #FFFFFF;
SCROLLBAR-SHADOW-COLOR: #FFFFFF;
SCROLLBAR-3DLIGHT-COLOR: #FFCBC8;
SCROLLBAR-ARROW-COLOR: #FFFFFF;
SCROLLBAR-TRACK-COLOR: #FFFFFF;
SCROLLBAR-DARKSHADOW-COLOR: #FFCBC8;
SCROLLBAR-BASE-COLOR: #FFFFFF
}

連續的英文或者一堆感歎號!!!不會自動換行的問題
只要在CSS中定義了如下句子,可保網頁不會再被撐開了

table{table-layout: fixed;}
td{word-break: break-all; word-wrap:break-word;}

注釋一下:

1.第一條table{table-layout: fixed;},此樣式可以讓表格中有!!!(感歎號)之類的字符時自動換行。

2.td{word-break: break-all},一般用這句這OK了,但在有些特殊情況下還是會撐開,因此需要再加上後面一句{word-wrap:break-word;}就可以解決。此樣式可以讓表格中的一些連續的英文單詞自動換行。


1、控制橫向和縱向滾動條的顯隱?
<body style="overflow-y:hidden"> 去掉x軸
<body style="overflow-x:hidden"> 去掉y軸
<body scroll="no">不顯
2、表格變色
<TD onmouseover="this.style.backgroundColor='#FFFFFF'"
onmouseout="this.style.backgroundColor=''"
style="CURSOR: hand">
3、 禁止復制,鼠標拖動選取
<body ondragstart=window.event.returnValue=false oncontextmenu=window.event.returnValue=false

onselectstart=event.returnValue=false>
4、 普通iframe頁面
<iframe name="name" src="main.htm" width="450" height="287" scrolling="Auto" frameborder="0">

</iframe>
5、iframe自適應高度
<iframe name="pindex" src="index.asp" frameborder=false scrolling="auto" width="100%"

height="100%" frameborder=no onload="document.all['pindex'].style.height=pindex.document.body.scrollHeight" ></iframe>
6、IE地址欄前換成自己的圖標&可以在收藏夾中顯示出你的圖標
<link rel="Shortcut Icon" href="favicon.ico">
<link rel="Bookmark" href="favicon.ico">
7、字號縮放
越來越多的人長時間的泡網,眼鏡的普及率也越來越高,讓文字大點,讓更多的用戶看的更清楚。
<script type="text/javascript">
function doZoom(size)
{document.getElementById('zoom').style.fontSize=size+'px';}
</script>
<span id="zoom">需要指定大小的文字</span>
<a href="javascript:doZoom(16)">大</a> <a href="javascript:doZoom(14)">中</a> <a href="javascript:doZoom(12)">小</a>
8、select擋住div的解決方法
在div裡加入下面的代碼,根據需要調整就可以了。
<iframe src="javascript:false" scrolling="no" frameborder="0" style="z-index:-1;position:absolute; top:5px; left:2px;width:168;height:100px;">
</iframe>
9、iframe(嵌入式幀)自適應高度
填寫的嵌入地址一定要和本頁面在同一個站點上,否則會提示“拒絕訪問!”。對跨域引用有權限問題,請查閱其他資料。
<iframe name="guestbook" src="gbook/index.asp" scrolling=no width="100%" height="100%"

frameborder=no onload="document.all['guestbook'].style.height=guestbook.document.body.scrollHeight"></iframe>
10、 跳轉菜單新窗口
<select name="select" onchange="window.open(this.options[this.selectedIndex].value)">
<option value="http://www.microsoft.com/ie"> Internet Explorer</option>
<option value="http://www.microsoft.com/"> Microsoft Home</option>
<option value="http://msdn.microsoft.com/"> Developer Network</option>
</select>
11、flash透明選項
<param name="wmode" value="transparent">
12、添加到收藏夾和設為首頁
<a href=# onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.makewing.com/lanren/');">設為首頁</a>

<a href="javascript:window.external.AddFavorite('http://www.makewing.com/lanren/','懶人圖庫')">收藏本站</a>
13、記錄並顯示網頁的最後修改時間
<script language=JavaScript>
document.write("最後更新時間: " + document.lastModified + "")
</script>
14、節日倒計時
<Script Language="JavaScript">
   var timedate= new Date("October 1,2002");
   var times= "國慶節";
   var now = new Date();
   var date = timedate.getTime() - now.getTime();
   var time = Math.floor(date / (1000 * 60 * 60 * 24));
   if (time >= 0)
   document.write( "現在離"+times+"還有: "+time +"天")
</Script>
15、加在HEAD裡
禁止緩存
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
16、 讓IFRAME框架內的文檔的背景透明
<iframe src="about:<body style='background:transparent'>" allowtransparency></iframe>
17、打開窗口即最大化
<script language="JavaScript">
<!-- Begin
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
// End -->
</script>
18、加入背景音樂
<bgsound src="mid/windblue[1].mid" loop="-1"> 只適用於IE
<embed src="music.mid" autostart="true" loop="true" hidden="true"> 對Netscape ,IE 都適用
19、 滾動
<marquee direction=up height=146 onmouseout=start() onmouseover=stop() scrollAmount=2>滾動信息
</marquee>
20、防止點擊空鏈接時,頁面往往重置到頁首端
代碼“javascript:void(null)”代替原來的“#”標記
21、文字或圖片彈出指定大小的窗口
在body中加入
<script language="JavaScript" type="text/JavaScript">
function MM_openBrWindow(theURL,winName,features) {window.open(theURL,winName,features);}
</script>
彈出代碼
<a href="#" target="_self" onClick="MM_openBrWindow('windows01.htm','','width=550,height=380')" width="550" height="380" border="0">圖片或文字</a>
22、 flash按鈕加鏈接
on (press) {
getURL("http://www.makewing.com%22,%22_blank/");
}
23、跳轉頁面代碼
<meta http-equiv="refresh" content="5;url=http://www.makewing.com">
24、細線分隔線
<hr noshade size=0 color=#C0C0C0>
25、網頁中的自動換行
<td style="word-break:break-all">就搞定了。
完整的是
style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word"
26、消除ie6自動出現的圖像工具欄,設置 GALLERYIMG屬性為false或no .
<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">
27、禁止頁面正文內容被選取
<body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false"

onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return
false"onmouseup="document.selection.empty()">
28、不能點右鍵,不用CTRL+A,不能復制作!
<body oncontextmenu="window.event.returnValue=false"
onkeypress="window.event.returnValue=false"
onkeydown="window.event.returnValue=false"
onkeyup="window.event.returnValue=false"
ondragstart="window.event.returnValue=false"
onselectstart="event.returnValue=false">
</body>
29、IE浏覽器支持一個 Body 屬性 bgproperties,它可以讓背景不滾動:
<Body Background="圖片文件" bgproperties="fixed">
30、隨機變換背景圖象(一個可以刷新心情的特效)
<Script Language="JavaScript">
   image = new Array(4); //定義image為圖片數量的數組
   image [0] = 'tu0.gif' //背景圖象的路徑
   image [1] = 'tu1.gif'
   image [2] = 'tu2.gif'
   image [3] = 'tu3.gif'
   image [4] = 'tu4.gif'
   number = Math.floor(Math.random() * image.length);
   document.write("<BODY BACKGROUND="+image[number]+">");
</Script>
31、flash載入影片
on (release)
{
loadMovie("1-01.swf", "_root.loaderclip");
}
32、圖片表單按鈕
<form id="form1" name="form1" method="post" action="">
<img src="login.gif" width="62" height="22" onclick="document.form1.submit()" />
</form>
33、左右陰影背景的CSS定義方法
body {
text-align:center;
background-repeat: repeat-y;
background-position: center;
background-image: url(../images/bg.jpg);
}
34、劃過鏈接 手型鼠標
style="cursor:hand"
35、如何關閉層
<div id="Layer1"></div>
<a href="#" onClick="Layer1.style.display='none'">關閉層</a>
36、關閉窗口的腳本
<a href=javascript:close()>[關閉窗口]</a>
37、如果文字過長,則將過長的部分變成省略號顯示
<DIV STYLE="width: 120px; height: 50px; border: 1px solid blue;overflow: hidden; text-overflow:ellipsis">
<NOBR>就是比如有一行文字,很長,表格內一行顯示不下.</NOBR>
</DIV>
38、進入主頁後自動最大化
<script>
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
</script>
39、凹陷文字
<div style="width:300px;padding:20px;overflow:hidden;word-wrap:break-word;word-break:break:all; font-size:12px; line-height:18px; background-color:#eeeeee;">
<font disabled>
怎麼樣,我凹下去了吧?<br>
你不想試試嗎?<br>
<a href="http://www.lenvo.cn/%22%3Ewww.lenvo.cn%3C/a%3E%3C/font>
</div>
40、運行代碼框
<script>
function Preview()
{var TestWin=open('');
TestWin.document.write(code.value);}
</script>
<textarea id=code cols=60 rows=15></textarea>
<br>
<button onclick=Preview() >運行</button>
41、給表格做鏈接
<table width="100%" onclick="window.open('http://www.makewing.com/', '_blank')" style="CURSOR:hand">
<tr>
<td height="100" bgcolor="f4f4f4">&nbsp;</td>
</tr>
</table>
42、讓彈出窗口總是在最上面
<body onblur="this.focus();">
43、CSS文字陰影
.shadowfont{FILTER: dropshadow(color=#666666, offx=1, offy=1, positive=1); FONT-FAMILY: "宋體"; FONT-SIZE: 9pt;COLOR: #ffffff;}
44、後退&關閉窗口
後退:javascript:history.back(1)
關閉:javascript:window.close();
45、表格透明
style="FILTER: alpha(opacity=72)"
46、如何避免別人把你的網頁放在框架中
<script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>
47、Alt和Title的區別
alt 用來給圖片來提示的。Title用來給鏈接文字或普通文字提示的。

<a href="#" Title="給鏈接文字提示">文字</a>
<p Title="給鏈接文字提示">文字</p>

<img src="圖片鏈接" alt="給圖片提示">
48、所有的javascript的調用盡量采取外部調用
<SCRIPT LANGUAGE="javascript" SRC="js/xxxxx.js"></SCRIPT>
49、鏈接到
response.redirect"login.asp"
location.href="xx.asp"
onClick="window.location='login.asp'"
onClick="window.open('')"
50、基本鏈接樣式
a:link 表示鏈接的樣式
a:active 表示當前活動連接的樣式
a:hover 表示鼠標劃過時的樣式
a:visited 表示已經訪問過的連接的樣式

"link-visited-hover-active" 簡記為 "lvha" 即 "love"+"hate"
51、在同一頁面設置不同文字鏈接效果的樣式
<style type="text/css">
.green {COLOR: #309633}
.green A:link {COLOR: #309633; TEXT-DECORATION: none}
.green A:visited {COLOR: #309633; TEXT-DECORATION: none}
.green A:hover {COLOR: #309633; TEXT-DECORATION: underline}
.green A:active {COLOR: #309633; TEXT-DECORATION: none}
</style>
<a href="#" class="green">文字</a>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved