天天看點

HTML小技巧的一些小技巧

<!-- @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:宋體; mso-font-charset:134; mso-generic-font-family:auto; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} @font-face {font-family:新細明體; panose-1:2 2 3 0 0 0 0 0 0 0; mso-font-alt:PMingLiU; mso-font-charset:136; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:3 137232384 22 0 1048577 0;} @font-face {font-family:"/@新細明體"; panose-1:2 2 3 0 0 0 0 0 0 0; mso-font-charset:136; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:3 137232384 22 0 1048577 0;} @font-face {font-family:"/@SimSun"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:none; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:新細明體; mso-font-kerning:1.0pt;} h1 {margin-right:0cm; mso-margin-top-alt:auto; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; mso-outline-level:1; font-size:24.0pt; font-family:新細明體; mso-font-kerning:18.0pt; font-weight:bold;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} p {margin-right:0cm; mso-margin-top-alt:auto; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:新細明體; mso-bidi-font-family:"Times New Roman";} @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:18.0pt;} div.Section1 {page:Section1;} -->

01.讓背景圖不滾動

IE浏覽器支援一個 Body 屬性 bgproperties,它可以讓背景不滾動:

〈Body Background="圖檔檔案" bgproperties="fixed"〉

02.讓你的網頁無法另存為

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

03.讓IFRAME架構内的文檔的背景透明

<iframe src="about:<body style='background:transparent'>" allowtransparency></iframe>

04.禁止右鍵:

<body οncοntextmenu="return false" οndragstart="return false" onselectstart ="return false" οnselect="document.selection.empty()" οncοpy="document.selection.empty()" onbeforecopy="return false"οnmοuseup="document.selection.empty()">

05.進入頁面後立即自動重新整理?

<meta http-equiv="refresh" content="120;url=http://www.XYZ.com/XYZ">

http://www.XYZ.com/XYZ,這是你自己的網址。

06.打開視窗即最大化

<script language="JavaScript">

<!-- Begin

self.moveTo(0,0)

self.resizeTo(screen.availWidth,screen.availHeight)

// End -->

</script>

07.能隐藏IFRAME的滾動條嗎?我知道的三種方法:

1. 設定iframe scrolling="no"

2. 被包含頁body應用overflow:hidden 即在被包含頁中應用15.如何控制橫向和縱向滾動條的顯隐?

3. 被包含頁的body标簽加scroll="no"

08.加入背景音樂

<bgsound src="mid/windblue[1].mid" loop="-1"> 隻适用于IE

<embed src="music.mid" autostart="true" loop="true" hidden="true"> 對Netscape ,IE 都适用

09.嵌入網頁

<iframe name="tt" src="01a.html" width="450" height="287" scrolling="Auto" frame></iframe>

10.跳轉

<meta http-equiv="refresh" content="3;URL=list.htm">

11.滾動

<MARQUEE direction=up height=146 οnmοuseοut=start() οnmοuseοver=stop() scrollAmount=4></marquee>

12.細線分隔線

<hr noshade size=0 color=#C0C0C0>

13.過度方式

<meta http-equiv="Page-Exit" content="revealTrans(Duration=3,Transition=5)">

Duration的值為網頁動态過渡的時間,機關為秒。

Transition是過渡方式,它的值為0到23,分别對應24種過渡方式。如下表:

0 盒狀收縮 1 盒狀放射 2 圓形收縮 3 圓形放射 4 由下往上

5 由上往下 6 從左至右 7 從右至左 8 垂直百葉窗 9 水準百葉窗

10 水準格狀百葉窗 11垂直格狀百葉窗 12 随意溶解 13從左右兩端向中間展開

14 從中間向左右兩端展開 15 從上下兩端向中間展開

16 從中間向上下兩端展開 17 從右上角向左下角展開

18 從右下角向左上角展開 19 從左上角向右下角展開

20 從左下角向右上角展開 21 水準線狀展開

22 垂直線狀展開 23 随機産生一種過渡方式

14.加入注釋的格式是:    

〈!-[注釋内容…]--〉

15.如何控制橫向和縱向滾動條的顯隐?

<body style="overflow-y:hidden"> 去掉x軸

<body style="overflow-x:hidden"> 去掉y軸

<body scroll="no">不顯。

16.定制浏覽器位址欄前的小圖示:

A:在網頁的〈head〉〈/head〉間加入以下語句:

〈link rel="shortcuticon" href="http://…/icon.ico" target="_blank" rel="external nofollow" 〉

即可。其中 icon.ico 為 16x16 的圖示檔案,顔色不要超過 16 色。

17.怎樣在網頁中加入 E-mail 連結并顯示預定的主題?

〈A href="mailto:[email protected]?subject=主題" target="_blank" rel="external nofollow" 〉……〈/a〉

18.定義本網頁關鍵字,可以在〈Head〉〈/Head〉中加入如下代碼:  

〈meta name="Keywords" content="china,enterprise,business,net"〉   

Content 中所包含的就是關鍵字,你可以自行設定。   

這裡有個技巧,你可以重複某一個單詞,這樣可以提高自己網站的排行位置,如:

〈meta name="Keywords" content="china,china,china,china"〉 這個關鍵字對于Google搜尋無效。

19.添加到收藏夾:

〈a href="javascript :window.external.addFavorite('http://連結','說明');" target="_blank" rel="external nofollow" 〉添加到收藏夾〈/a〉

20.設為首頁:

〈a href=# οnclick=this.style.behavior='url(#default#homepage)';this.setHomePage('http://連結');〉設為首頁〈/a〉

21.把滾動條放在浏覽器視窗的左邊

A:在 <body> 中加 dir=RTL,即 <body dir=RTL>。

另附:IE5.0 的部分快捷鍵:

A:打開查找功能:Ctrl+F

關閉浏覽器視窗:Ctrl+W

打開位址欄下拉清單框:F4

刷 新:F5

将目前Web頁儲存到收藏夾清單:Ctrl+D

打開目前 IE 視窗的一個拷貝:Ctrl+N

停止下載下傳目前網頁:Esc

光标迅速移動到網頁的開頭:Home

光标迅速移動到網頁的尾部:End

打開新的位址鍵入視窗:Ctrl+O

打開收藏夾:Ctrl+I

打開曆史記錄檔案夾:Ctrl+H

打開浏覽器設定的預設首頁:Alt+HOME

繼續閱讀