1.忽視右鍵
<body >
或
<body style="overflow-y:hidden"> 轉(zhuǎn)自:奈薇建站網(wǎng)(www.nev.cn)
2.加入背景音樂
IE:<bgsound src="*.mid" loop=infinite>
NS:<embed src="*.mid" autostart=true hidden=true loop=true>
</embed>
*.mid你的背景音樂的midi格式文件
3.簡單的window.open方法
<a href="#" >文字或圖片</a>
參數(shù)解釋:
<script LANGUAGE="javascript"> js腳本開始;
window.open 彈出新窗口的命令;
文件路徑/文件名彈出窗口的文件名;
newwindow 彈出窗口的名字(不是文件名),非必須,可用空代替;
width=400 窗口寬度;
height=300 窗口高度;
top=0 窗口距離屏幕上方的象素值;
left=0 窗口距離屏幕左側(cè)的象素值;
toolbar=no 是否顯示工具欄,yes為顯示;
menubar,scrollbars 表示菜單欄和滾動欄。
resizable=no 是否允許改變窗口大小,yes為允許;
location=no 是否顯示地址欄,yes為允許;
status=no 是否顯示狀態(tài)欄內(nèi)的信息(通常是文件已經(jīng)打開),yes為允許;
</script> js腳本結(jié)束
4.簡單的頁面加密
<script LANGUAGE="javascript">
<!--
function loopy(){
var sWord ="";
while(sWord!="login"){sWord=prompt("請輸入你的登陸密碼");}
alert("登陸成功!");
}
loopy()
//-->
</script>
5.拉動頁面時(shí)背景圖不動
<style>
body{background-image:url(logo.gif);
background-repeat:no-repeat;background-position:center}
</style>
6.讓瀏覽器在保存頁面時(shí)保存失敗
<NOscript><iframe src="*.html"></iframe></NOscript>
7.隨機(jī)替換圖片
<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.窗口定時(shí)關(guān)閉
先將如下代碼網(wǎng)頁文件的區(qū):
<script language="javascript">
function closeit() { setTimeout("self.close()",10000) //毫秒}
</script>
然后再在<body>標(biāo)內(nèi)加入如:<body >
9.網(wǎng)頁自動關(guān)閉
<html>
<head>
<object id=closes type="application/x-oleobject"
classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
</head>
<body >
這個窗口會在10秒過后自動關(guān)閉,而且不會出現(xiàn)提示.
</body>
</html>
10.網(wǎng)頁自動刷新
在head部記入
<meta HTTP-EQUIV="Refresh" c>
其中20為20秒后自動刷新,你可以更改為任意值。
11.網(wǎng)頁自動轉(zhuǎn)頁
<meta HTTP-EQUIV="Refresh" C>
12.保持layer在最前面,而不被Iframe、Object所覆蓋
在Layer中再插Iframe 或 Object 設(shè)z-Index值
<div z-Index:2><object xxx></object> #前面
<div z-Index:1><object xxx></object> #后面
<div id="Layer2" style="position:absolute; top:40;width:400px;
height:95px;z-index:2"> height=100% width=100%>
<iframe width=0 height=0></iframe>
</div>
<div id="Layer1" style="position:absolute; top:50;width:200px;height:115px;z-index:1">
<iframe height=100% width=100%></iframe>
</div>
13.返回上一頁
<a href=javascript :history.back(1)>『返回上一頁』</a>
14.關(guān)閉窗口
<a href=javascript :self.close()>『關(guān)閉窗口』</a>
15.關(guān)于iframe的透明背景 轉(zhuǎn)自:奈薇建站網(wǎng)(www.nev.cn)
<IFRame ID="iFrame1" SRC="iframe.htm" allowTransparency="true" style="background-color: green"></IFRame>
|