33. 選擇了哪一個Radio
<HTML> <script language="vbscript"> function checkme() for each ob in radio1 if ob.checked then window.alert ob.value next end function </script> <BODY> <INPUT name="radio1" type="radio" value="/style" checked>Style <INPUT name="radio1" type="radio" value="/blog/barcode">Barcode <INPUT type="button" value="check" onclick="checkme()"> </BODY> </HTML> |
34.腳本永不出錯
<SCRIPT LANGUAGE="JavaScript"> <!-- Hide function killErrors() { return true; } window.onerror = killErrors; // --> </SCRIPT> |
35.ENTER鍵可以讓光標移到下一個輸入框
<input onkeydown="if(event.keyCode==13)event.keyCode=9"> |
36. 檢測某個網站的鏈接速度:
把如下代碼加入<body>區域中:
<script language=Javascript> |
37. 各種樣式的光標
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 |
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種隨機選擇一種 |
39.在規定時間內跳轉
<META http-equiv=V="REFRESH" content="5;URL=http://www.chinaz.com"> |
40.網頁是否被檢索
<meta name="ROBOTS" content="屬性值"> 其中屬性值有以下一些: 屬性值為"all": 文件將被檢索,且頁上鍊接可被查詢; 屬性值為"none": 文件不被檢索,而且不查詢頁上的鏈接; 屬性值為"index": 文件將被檢索; 屬性值為"follow": 查詢頁上的鏈接; 屬性值為"noindex": 文件不檢索,但可被查詢鏈接; 屬性值為"nofollow": 文件不被檢索,但可查詢頁上的鏈接。 |
41、email地址的分割
把如下代碼加入<body>區域中
<a href="mailto:[email protected]">[email protected] </a> |
42、流動邊框效果的表格
把如下代碼加入<body>區域中
<SCRIPT> l=Array(6,7,8,9,'a','b','b','c','d','e','f') Nx=5;Ny=35 t=" <table border=0 cellspacing=0 cellpadding=0 height="+((Nx+2)*16)+"> <tr>" for(x=Nx;x <Nx+Ny;x++) t+=" <td width=16 id=a_mo"+x+"> </td>" t+=" </tr> <tr> <td width=10 id=a_mo"+(Nx-1)+"> </td> <td colspan="+(Ny-2)+" rowspan="+( Nx)+"> </td> <td width=16 id=a_mo"+(Nx+Ny)+"> </td> </tr>" for(x=2;x <=Nx;x++) t+=" <tr> <td width=16 id=a_mo"+(Nx-x)+"> </td> <td width=16 id=a_mo"+(Ny+Nx+x-1)+"> </td> </tr>" t+=" <tr>" for(x=Ny;x>0;x--) t+=" <td width=16 id=a_mo"+(x+Nx*2+Ny-1)+"> </td>" ***(t+" </tr> </table>") var N=Nx*2+Ny*2 function f1(y){ for(i=0;i <N;i++){ c=(i+y)%20;if(c>10)c=20-c document.all["a_mo"+(i)].bgColor=""""#0000"+l[c]+l[c]+"'"} y++ setTimeout('f1('+y+')','1')} f1(1) </SCRIPT> |
43、JavaScript主頁彈出窗口技巧
窗口中間彈出
<script> window.open("http://www.chinaz.com","","width=400,height=240,top="+(screen.availHeight-240)/2+",left="+(screen .availWidth-400)/2); </script> ============ <html> <head> <script language="LiveScript"> function WinOpen() { msg=open("","DisplayWindow","toolbar=no,directories=no,menubar=no"); msg.***(" <HEAD> <TITLE>哈羅! </TITLE> </HEAD>"); msg.***(" <CENTER> <H1>酷斃了! </H1> <h2>這是<B>JavaScript </B>所開的視窗! </h2> </CENTER>"); } </script> </head> <body> <form> <input type="button" name="Button1" value="Push me" onclick="WinOpen()"> </form> </body> </html> |
一、在下面的代碼中,你只要單擊打開一個窗口,即可鏈接到中國站長站。而當你想關閉時,只要單擊一下即可關閉剛才打開的窗口。
代碼如下:
<SCRIPT language="JavaScript"> <! -- function openclk() { another=open('1000){this.resized=true;this.style.width=1000;}" align=absMiddle border=0>http://www.chinaz.com','NewWindow'); } function closeclk() { another.close(); } //--> </SCRIPT> <FORM> <INPUT TYPE="BUTTON" NAME="open" value="/打開一個窗口" onClick="openclk()"> <BR> <INPUT TYPE="BUTTON" NAME="close" value="/blog/關閉這個窗口" onClick="closeclk()"> </FORM> |
二、上面的代碼也太靜了,為何不來點動感呢?如果能給頁面來個降落效果那該多好啊!
代碼如下:
<script> function drop(n) { if(self.moveBy){ self.moveBy (0,-900); for(i = n; i > 0; i--){ self.moveBy(0,3); } for(j = 8; j > 0; j--){ self.moveBy(0,j); self.moveBy(j,0); self.moveBy(0,-j); self.moveBy(-j,0); } } } </script> <body onLoad="drop(300)"> |
三、討厭很多網站總是按照默認窗口打開,如果你能隨心所欲控制打開的窗口那該多好。
代碼如下:
<SCRIPT LANGUAGE="JavaScript"> <! -- Begin function popupPage(l, t, w, h) { var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes" + ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h; var URL = "http://www.80cn.com"; popup = window.open(URL,"MenuPopup",windowprops); } // End --> </script> <table> <tr> <td> <form name=popupform> <pre> 打開頁面的參數<br> 離開左邊的距離: <input type=text name=left size=2 maxlength=4> pixels 離開右邊的距離: <input type=text name=top size=2 maxlength=4> pixels 窗口的寬度: <input type=text name=width size=2 maxlength=4> pixels 窗口的高度: <input type=text name=height size=2 maxlength=4> pixels </pre> <center> <input type=button value="打開這個窗口!" onClick="popupPage(this.form.left.value, this.form.top.value, this.form.width.value, this.form.height.value)"> </center> </form> </td> </tr> </table> |
你只要在相對應的對話框中輸入一個數值即可,將要打開的頁面的窗口控制得很好。