1. 程式人生 > >jsp/html開發中常用的JS程式碼和頁面特效程式碼

jsp/html開發中常用的JS程式碼和頁面特效程式碼

1.jsp/html開發中常用的JS程式碼

1、後退 前進

<input type="button" value="後退" onClick="history.go(-1)"> 
<input type="button" value="前進" onClick="history.go( 1 );return true;">

2、返回

<input type="button" value="返回上一步" onClick="history.back(-1)">

3、檢視原始碼

<input type="button" name="view" value="檢視原始碼" onClick="window.location="view-source:" +window.location.href">

4、禁止檢視原始碼

<body oncontextmenu="return false"></body>  

5、重新整理按鈕一

<input type="button" value="重新整理按鈕一" onClick="ReloadButton()"> 
<script>function ReloadButton(){location.href="i001.htm";}</script>

重新整理按鈕二

<input type="button" value="重新整理按鈕二" onClick="history.go(0)">

6、回首頁按鈕

<input type="button" value="首頁" onClick="HomeButton()"> 
<script>function HomeButton(){location.href=http://www.winliuxq.com;}</script>

7、彈出警告框

<input type="button" value="彈出警告框" onClick="AlertButton()"> 
<script>function AlertButton(){window.alert("要多多光臨呀!");}</script>

8、狀態列資訊

<input type="button" value="狀態列資訊" onClick="StatusButton()"> 
<script>function StatusButton(){window.status="要多多光臨呀!";}</script>

9、背景色變換

<form><input type="button" value="背景色變換" onClick="BgButton()"></form> 
<script>function BgButton(){ 
if (document.bgColor=='#00ffff') 
    {document.bgColor='#ffffff';} 
else{document.bgColor='#00ffff';} 
} 
</script>

10、開啟新視窗

<input type="button" value="開啟新視窗" onClick="NewWindow()"> 
<script>function NewWindow(){window.open("c01.htm","","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");} 
</script>

11、視窗最小化

<OBJECT id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><PARAM name="Command" value="Minimize"></OBJECT><button onClick="min.Click()">視窗最小化</button>

12、全屏程式碼

<input type="BUTTON" name="FullScreen" value="全屏顯示" onClick="window.open(document.location, 'butong_net', 'fullscreen')">

13、關閉視窗

<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><param name="Command" value="Close"></object><input type="button" value="關閉視窗" onClick="closes.Click();">

關閉視窗

<input type=button value=關閉視窗 onClick="javascript:self.close()">  

14、最大化

<object id=big classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">   
<param name="Command" value="Maximize"></object><input type=button value=最大化 onClick=big.Click()>

15、關閉輸入法

<input style="ime-mode:disabled" value=關閉輸入法>

16、連結按鈕1

<input type="button" value="連結按鈕1" onClick="window.open('http://www.winliuxq.com/', 'Sample', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width=790,height=520,left=0,top=0')" name="input">

連結按鈕2

<input type="BUTTON" NAME="Button" value="連結按鈕2" onClick="showModalDialog('http://www.winliuxq.com/')">

連結按鈕3

<input type="submit" value="連結按鈕3" onClick="location.href='http://www.winliuxq.com/'">

17、警告框顯示原始碼

<BUTTON onClick=alert(document.documentElement.outerHTML) style="width:110">警告框顯示原始碼</BUTTON>

18、點選後按鈕清空

<input type=button value='列印' onClick="this.style.visibility='hidden';window.print();">

19、列印

<input type=button value='列印' onClick="window.print();">

20、列印預覽

<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT> 
<input type=button value=列印預覽 onclick="wb.execwb(7,1)">

21、另存為

<input onClick="document.execCommand('saveas','true','常用程式碼.htm')" type=button value=另存為>

22、點選自動複製

<script>function oCopy(obj){obj.select();js=obj.createTextRange();js.execCommand("Copy")}</script> 
<input type="text" value="點選自動複製" onClick="oCopy(this)" size="11">

23、自動選中

<input value="自動選中" onFocus="this.select()" onMouseOver="this.focus()" size="11">

24、開啟原始碼

<BUTTON onClick="document.location = 'view-source:' + document.location" size="7">開啟原始碼</BUTTON>

25、新視窗延遲開啟

<input type=button value=新視窗延遲開啟 onClick=javascript:setTimeout("window.open('http://www.winliuxq.com/')",10000)>

26、實現選中文字框裡的前一半的內容

<input type="text" value="選中文字框裡的前一半的內容" size=30 onmouseover="this.select();tR=document.selection.createRange();tR.moveEnd('character',-8);tR.select();"> 
<input type="text" value="選中部分內容,非IE可以用這個" size=30 onmouseover="this.selectionStart=this.value.length-4;this.selectionEnd=this.value.length"> 

27、點選清空文字

<input type="text" name="artist" size=14 value="點選清空文字" onmouseover=this.focus() onfocus=this.select() onclick="if(this.value=='點選清空文字')this.value=''">  

點選清空文字

<input name=name size=11 value=點選清空文字 onMouseOver=this.focus() onblur="if (this.value =='') this.value='點選清空文字'" onFocus=this.select() onClick="if (this.value=='點選清空文字') this.value=''">

28、等於標題(title):

<input type="text" value="" id="aa" size="20"> 
<script>document.getElementById("aa").value=document.title;</script>

29、檢測IE是否離線

<input type="button" value="測試" onclick="alert(window.navigator.onLine)">

30、11種重新整理按鈕的方法

<input type=button value=重新整理 onClick="history.go(0)"> 
<input type=button value=重新整理 onClick="location.reload()"> 
<input type=button value=重新整理 onClick="location=location"> 
<input type=button value=重新整理 onClick="location.assign(location)"> 
<input type=button value=重新整理 onClick="document.execCommand('Refresh')"> 
<input type=button value=重新整理 onClick="window.navigate(location)"> 
<input type=button value=重新整理 onClick="location.replace(location)"> 
<input type=button value=重新整理 onClick="window.open('自身的檔案','_self')"> 
<input type=button value=重新整理 onClick=document.all.WebBrowser.ExecWB(22,1)>   
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT> 
<form action="自身的檔案"><input type=submit value=重新整理></form> 
<a id=a1 href="自身的檔案"></a><input type=button value=重新整理 onClick="a1.click()">

31、 開啟網頁

<a href="#" onClick=document.execCommand("open")>開啟</a>

32、開啟指定大小網頁

<a onclick="window.open('i001.htm','','height=300,width=300,resizable=no,location=net');" href="">開啟指定大小網頁</a>

33、使用記事本編輯

<a href="#" onClick=location.replace("view-source:"+location)>使用 記事本 編輯</a>

34、另存為

<a href="#" onClick=document.execCommand("saveAs")>另存為</a>

35、列印

<a href="#" onClick=document.execCommand("print")>列印</a> 
<a href="javascript:window.print();">列印</a>

36、傳送E-mail

<a href=mailto:[email protected]>傳送E-mail</a>

37、全選操作

<a href="#" onClick=document.execCommand("selectAll")>全選</a>

38、重新整理

<a href="#" onClick=location.reload()>重新整理1</a>

39、重新整理

<a href="#" onClick=history.go(0)>重新整理2</a>

40、檢視原始檔

<a href="#" onClick=location.replace("view-source:"+location)>檢視原始檔</a> 

41、全屏顯示

<a href="#" onClick=window.open(document.location,“url”,“fullscreen”)>全屏顯示

42、internet選項

<a href="#" onClick=window.external.showBrowserUI("PrivacySettings",null)>internet選項</a>

43、單擊右鍵將在新視窗中開啟

<a href="#" oncontextmenu="window.open(this.href);return false;">單擊右鍵將在新視窗中開啟</a>

44、前進與後退

<a href="#" onClick=history.go(1)>前進1</a>
<a href="#" onClick=history.forward()>前進2</a>
<a href="#" onClick=history.go(-1)>後退1</a>
<a href="#" onClick=history.back()>後退2</a>

45、加入收藏,點選加入收藏夾,滑鼠感應設為首頁

<a href="#" onClick=window.external.showBrowserUI("OrganizeFavorites",null)>整理收藏夾</a>
<SPAN onClick="window.external.addFavorite('http://www.winliuxq.com/','網頁特效站點 ')" style="CURSOR: hand" title=網頁特效站點>加入收藏</SPAN>
<a href="#" onClick="window.external.addFavorite('http://www.winliuxq.com/','網頁特效站點')">新增到收藏夾</A>
<a href="javascript:window.external.AddFavorite('http://www.winliuxq.com/', '網頁特效站點')">點選加入收藏夾</a>
<a href="#" onmouseover="window.external.addFavorite('http://www.winliuxq.com/','網頁特效站點')" target="_self" >滑鼠感應收藏本站</a>
<a href="#" onmouseover="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.yiloo.com/js/');" target="_self">滑鼠感應設為首頁</a>

46、關閉視窗

<a href="javascript:window.close()">關閉視窗</a>
<a href="#" onClick=window.close();return false)>關閉視窗</a>
<a href="#" onClick=setTimeout(window.close(),3000)>3秒關閉本視窗</a>
<script> 
function shutwin(){ 
window.close(); 
return;} 
</script> 
<a href="javascript:shutwin();">關閉本視窗</a>

47、設為首頁

<SPAN onClick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.winliuxq.com/');" style="CURSOR: hand">設為首頁</SPAN>

48、等於標題欄:

<script>document.write(document.title);</script>

49、收藏本頁

<a href="javascript:void(0);" onClick='window.external.AddFavorite(location.href, document.title);'>收藏本頁</a>
<a href="javascript:window.external.AddFavorite(document.location.href, document.title)">收藏本頁</a>
<a href=javascript:window.external.addChannel("typhoon.cdf")>加入頻道</a> 

50、雙擊開啟連結

<a href="i003.htm" onclick="return false;" ondblclick="window.open('i003.htm');">雙擊開啟連結</a>

51、關閉視窗

<style>#close a:hover {background:url(javascript:window.opener=0;window.close());}</style><div id=close><a href="">關閉視窗</a></div>

52、連結禁止

<A HREF="javascript:void(0)" onMouseover="alert('對不起,禁止選中!')">連結禁止</A> 

53、滾動條在左側,

將<html>改為<HTML DIR="RTL">

54、網頁半透明

<body style="filter:Alpha(Opacity=50)">

55、隨機選擇背景色

<body> 
<script> 
document.body.style.background=(["red","blue","pink","navy","gray","yellow","green","purple"])[parseInt(Math.random()*8)]; 
</script>

56、框架頁中不顯示滾動條:

<SCRIPT> 
self.moveTo(0,0) 
self.resizeTo(screen.availWidth,screen.availHeight) 
</SCRIPT>

57、防止網頁被框架

<SCRIPT LANGUAGE=JAVASCRIPT> 
if (top.location !== self.location) { 
top.location=self.location; 
} 
</SCRIPT>

58、永遠都會帶著框架

<script language="javascript"><!--   
if (window == top)top.location.href = "frame.htm"; //frame.htm為框架網頁   
// --></script>

59、視窗自動最大化

<script language="JavaScript"><!-- 
self.moveTo(0,0) 
self.resizeTo(screen.availWidth,screen.availHeight) 
//--></script>

60、開啟視窗自動最大化

<OBJECT classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" onreadystatechange="if (this.readyState==4) this.Click();" VIEWASTEXT><PARAM name="Command" value="Maximize"></OBJECT>

61、爽眼閃屏程式碼

<script>var color = new Array;color[1] = "black";color[2] = "white";for(x = 0; x <3; x++){document.bgColor = color[x];if(x == 2){x = 0;}}</script>

62、不能被另存為

<noscript><iframe src=*.html></iframe></noscript>

63、漢字字型檔呼叫

<script> 
for(i=19968;i<40870;i++)document.write(String.fromCharCode(i)); 
</script>

64、顯示現在時間的指令碼

<script language=vbscript>document.write now</script>

65、顯示最後修改時間的指令碼

<script>document.write(document.lastModified)</script>  

66、按下F12鍵,直接返回首頁

<script>function look(){   
if(event.keyCode==123){document.location.href=http://www.winliuxq.com/}   
}   
if(document.onkeydown==null)   
{document.onkeydown=look}   
</script>  

67、埠檢測

<img src="http://www.winliuxq/zza.jpg" onload="alert('埠可用')" onerror="alert('埠禁止')"...>

68、無法最小化的視窗

<body onblur='self.focus();'>

69、連結點外部css檔案

<style>@import url("ie.css");</style>

70、內嵌式框架-網頁中呼叫另外網頁:

<object type="text/x-scriptlet" width="600" height="1000" data="http://www.winliuxq.com/"></object>

71、重新整理改變視窗大小

<OBJECT classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" onreadystatechange="if (this.readyState==4) this.Click();" VIEWASTEXT><PARAM name="Command" value="Maximize"></OBJECT>

72、JavaScript實現網頁豎虛線

<script>hei=120;d1=2;d2=2;cou=Math.floor(hei/(d1+d2)); 
document.write('<table cellspacing=0 cellpadding=0 width=1 height='+hei+'>'); 
for(i=0;i<cou;i++){document.write('<tr><td height='+d2+'><tr><td height='+d1+' bgcolor=333333>')}</script></table>

73、js翻頁

<script>document.write("<a href="+location.href.replace(/\.html/g,"_2.html")+">2</a>");</script>

2.Html開發中常用的頁面特效程式碼

  1. 加入連線:<a href="所要連線的相關地址">寫上你想寫的字</a>

  2. 在新視窗開啟連線:<a href="相關地址" target="_blank">寫上要寫的字</a>

  3. 消除連線的下劃線在新視窗開啟連線:

  4. 移動字型(走馬燈):<marquee>寫上你想寫的字</marquee>

  5. 字型加粗:<b>寫上你想寫的字</b>

  6. 字型斜體:<i>寫上你想寫的字</i>

  7. 字型下劃線:  <u>寫上你想寫的字</u>

  8. 字型刪除線:  <s>寫上你想寫的字</s>

  9. 字型加大: <big>寫上你想寫的字</big>

  10. 字型控制大小:<h1>寫上你想寫的字</h1> (其中字型大小可從h1-h5,h1最大,h5最小)

  11. 更改字型顏色:<font color="#value">寫上你想寫的字</font>(其中value值在000000與ffffff(16位進位制)之間

  12. 貼音樂:<embed src=音樂地址 width=300 height=45 type=audio/mpeg autostart="false">

  13. 貼flash: <embed src="flash地址" width="寬度" height="高度">

  14. 原始文字樣式:<pre>正文</pre>

  15. 換背景:<body background="背景圖片地址">

  16. 固定帖子背景不隨滾動條滾動:

<body background="背景圖片地址" body bgproperties=fixed>

  1. 定製背景顏色:<body bgcolor="#value">(h1-6)
  2. 背景音樂:<bgsound="背景音樂地址" loop=infinite>
  3. 貼網頁:<iframe src="相關地址" width="寬度" height="高度"></iframe>

----------------------------------------HTML特效程式碼--------------------------------

  1. 忽視右鍵:<body oncontextmenu="return false"> 或<body style="overflow-y:hidden">

  2. 加入背景音樂:

IE:<bgsound src="*.mid" loop=infinite>     
    NS:<embed src="*.mid" autostart=true hidden=true loop=true>    </embed>  

*.mid你的背景音樂的midi格式檔案

  1. 簡單的window.open方法:
<a href="#"  
    onclick="javascript :window.open(檔案路徑/檔名,newwindow,    toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,    width=400,height=300);">文字或圖片</a>
  1. 拉動頁面時背景圖不動 :

     <style> body{background-image:url(logo.gif);     background-repeat:no-repeat;background-position:center}    </style>
     <style> body{background-image:url(logo.gif);     background-repeat:no-repeat;background-position:center}    </style>
    

6。讓瀏覽器在儲存頁面時儲存失敗:

<NOSCRIPT><iframe src="*.html"></iframe></NOSCRIPT> 

7。隨機替換圖片

<script>     document.write(<img src="img/+parseInt(Math.random()*(5))    +.gif"height="40" width="50">    </script>

圖片檔名為0.gif 1.gif 2.gif 3.gif 4.gif

8。視窗定時關閉:

先將如下程式碼:

<script language="javascript">     function closeit() { setTimeout("self.close()",10000) //毫秒 }    </script>

然後再在標內加入如:<body onload="closeit()">

9。網頁自動關閉:

<html><head><object id=closes type="application/x-oleobject"    classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><param name="Command" value="Close"></object></head><body onload="window.setTimeout(closes.Click(),10000)">    這個視窗會在10秒過後自動關閉,而且不會出現提示.</body></html>   

10。網頁自動重新整理:

在head部記入

<META HTTP-EQUIV="Refresh" content="20"> 

其中20為20秒後自動重新整理,你可以更改為任意值。

11。網頁自動轉頁

<META HTTP-EQUIV="Refresh" CONTENT="時間(秒);URL=地址"> 

13。返回上一頁

<a href=javascript :history.back(1)>『返回上一頁』</a>  

14。關閉視窗

<a href=javascript :self.close()>『關閉視窗』</a> 

15.oncontextmenu="window.event.returnValue=false"

將徹底遮蔽滑鼠右鍵 :

<table border oncontextmenu=return(false)><td>no</table> 可用於Table 

取消選取、防止複製  :<body onselectstart="return false">

18.onpaste="return false" 不準貼上

19.oncopy="return false;" oncut="return false;" 防止複製

20. IE位址列前換成自己的圖示

<link rel="Shortcut Icon" href="favicon.ico">   

21.可以在收藏夾中顯示出你的圖示

<link rel="Bookmark" href="favicon.ico"> 

22. 關閉輸入法: <input style="ime-mode:disabled">

24. 防止被人frame:

<SCRIPT LANGUAGE=JAVASCRIPT><!--   if (top.location != self.location)top.location=self.location;  // --></SCRIPT>

網頁將不能被另存為:

<noscript><iframe src=*.html></iframe></noscript>

28.遮蔽功能鍵Shift,Alt,Ctrl:

<script>   function look(){  if(event.shiftKey)   alert("禁止按Shift鍵!"); //可以換成ALT CTRL  }   document.onkeydown=look;  </script>

29. 網頁不會被快取 :

<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">   

30.怎樣讓表單沒有凹凸感?

 <input type=text style="border:1 solid #000000">   或 <input type=text style="border-left:none; border-right:none; border -top:none; border-bottom: 1 solid #000000"></textarea>

31.不要滾動條

讓豎條沒有:

<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>   

33.電子郵件處理提交表單

<form name="form1" method="post" action="mailt****@***.com" enctype="text/plain">  <input type=submit>   </form>   

34.在開啟的子視窗重新整理父視窗的程式碼裡如何寫?

window.opener.location.reload()  

35.如何設定開啟頁面的大小   <body onload="top.resizeTo(300,200);">   開啟頁面的位置<body onload="top.moveBy(300,200);">

36.在頁面中如何加入不是滿鋪的背景圖片,拉動頁面時背景圖不動

<STYLE>  body   {background-image:url(logo.gif); background-repeat:no-repeat;  background-position:center;background-attachment: fixed}  </STYLE>  

37. 檢查一段字串是否全由數字組成

<script language="Javascript"><!--   function checkNum(str){return str.match(//D/)==null}  alert(checkNum("1232142141"))  alert(checkNum("123214214a1"))  // --></script>   

38. 獲得一個視窗的大小

document.body.clientWidth; document.body.clientHeight  

39. 怎麼判斷是否是字元

 if (/[^/x00-/xff]/g.test(s)) alert("含有漢字");  else alert("全是字元");    

40.TEXTAREA自適應文字行數的多少

<textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">  </textarea>   

43.指令碼永不出錯

<SCRIPT LANGUAGE="JavaScript">   <!-- Hide function killErrors(){return true;} window.onerror = killErrors; // -->  </SCRIPT>

44.ENTER鍵可以讓游標移到下一個輸入框

 <input onkeydown="if(event.keyCode==13)event.keyCode=9"> 

46. 各種樣式的游標

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

47. 禁止滑鼠右鍵,把Demo的圖片全都設為表格的背景,表格的大小與圖片的大小一樣。這樣做看起來是一樣的,主要是防止滑鼠經過圖片時會出現另存的按鈕。

禁止滑鼠右鍵:

 <script LANGUAGE="JavaScript">  function click() { if (event.button==2)   {alert(呵呵,不好意思,你甭想使用右鍵下載圖片:)); } } document.onmousedown=click </script>

48、在網頁的Head部分加入如下程式碼,這段程式碼的主要功能是遮蔽PrintScreen鍵,不斷清空剪貼版,防止圖片被用檔案——另存為選單另存。

<script language="javascript"> <!--  function testclip(){ try {  if(clipboardData.getData("Text")||clipboardData.getData("HTML")||clipboardData.getData("URL"))  { null; } }  catch(e){  clipboardData.setData("Text","") }  setTimeout("testclip()",500) }  testclip(); //--> </script>

38.頁面進入和退出的特效

進入頁面

<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">

退出頁面 <meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)">

這個是頁面被載入和調出時的一些特效。

Duration表示特效的持續時間,以秒為單位。Transition表示使用哪種特效,取值為1-23:

0 矩形縮小    1 矩形擴大    2 圓形縮小   3 圓形擴大    4 下到上重新整理    5 上到下重新整理   6 左到右重新整理    7 右到左重新整理    8 豎百葉窗   9 橫百葉窗    10 錯位橫百葉窗    11 錯位豎百葉窗   12 點擴散     13 左右到中間重新整理    14 中間到左右重新整理   15  中間到上下    16 上下到中間    17 右下到左上   18 右上到左下    19 左上到右下    20 左下到右上   21 橫條    22 豎條     23 以上22種隨機選擇一種

40.網頁是否被檢索:

 <meta name="ROBOTS" content="屬性值"> 

其中屬性值有以下一些:

屬性值為"all": 檔案將被檢索,且頁上鍊接可被查詢;   屬性值為"none": 檔案不被檢索,而且不查詢頁上的連結;  屬性值為"index": 檔案將被檢索;   屬性值為"follow": 查詢頁上的連結;  屬性值為"noindex": 檔案不檢索,但可被查詢連結;   屬性值為"nofollow": 檔案不被檢索,但可查詢頁上的連結。

在同一頁面設定不同文字連結效果的樣式.:

<HTML><HEAD><TITLE>如何在同一頁面設定不同文字連結效果的樣式</TITLE>  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  <style type="text/css">  <!--   a:hover { font-size: 9pt; color: #FF0000; text-decoration: underline}  a:link { font-size: 9pt; color: #006699; text-decoration: underline}  a:visited { font-size: 9pt; color: #006699; text-decoration: underline}  a:active { font-size: 9pt; color: #FF0000; text-decoration: none}   a.r1:hover { font-size: 9pt; color: #FF0000; text-decoration: underline overline}  a.r1:link { font-size: 9pt; color: #000000; text-decoration: underline overline}  a.r1:visited { font-size: 9pt; color: #99CC00; text-decoration: underline overline}  a.r1:active { font-size: 9pt; color: #000000; text-decoration: underline overline}  -->  </style>  </head>   <body bgcolor="#FFFFFF" text="#000000">  <a href="#">下劃線連結 </a>   <p></p>   <a href="#" class="r1">雙下劃線連結</a>  </BODY>  </HTML> 

補充說明:   a:hover 表示滑鼠劃過時的樣式.  a:link 表示連結的樣式.   a:active 表示當前活動連線的樣式.   a:visited 表示已經訪問過的連線的樣式.