控制橫向和縱向滾動條的顯隱?
<body style="overflow-y:hidden"> 去掉x軸
<body style="overflow-x:hidden"> 去掉y軸
<body scroll="no">不顯
表格變色
<TD onmouseover="this.style.backgroundColor='#FFFFFF'"
onmouseout="this.style.backgroundColor=''"
style="CURSOR: hand">
禁止複製,鼠標拖動選取
<body ondragstart=window.event.returnValue=false oncontextmenu=window.event.returnValue=false onselectstart=event.returnValue=false>
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>
IE地址欄前換成本身的圖標&能夠在收藏夾中顯示出你的圖標
<link rel="Shortcut Icon" href="favicon.ico">
<link rel="Bookmark" href="favicon.ico">
字號縮放
愈來愈多的人長時間的泡網,眼鏡的普及率也愈來愈高,讓文字大點,讓更多的用戶看的更清楚。
<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>
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>
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>
跳轉菜單新窗口
<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>
flash
透明選項
<param name="wmode" value="transparent">
添加到收藏夾和設爲首頁
添加到收藏夾:
<a href="javascript:window.external.addFavorite('http://連接','說明');">添加到收藏夾</a>
設爲首頁:
<a href=# onclick=this.style.behavior='url(#default#homepage)';this.setHomePage ('http://連接');>設爲首頁</a>
記錄並顯示網頁的最後修改時間
<script language=JavaScript>
document.write("最後更新時間: " + document.lastModified + "")
</script>
節日倒計時
<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>
加在HEAD裏
禁止緩存
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
讓IFRAME框架內的文檔的背景透明
<iframe src="about:<body style='background:transparent'>" allowtransparency></iframe>
打開窗口即最大化
<script language="JavaScript">
<!-- Begin
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
// End -->
</script>
加入背景音樂
<bgsound src="mid/windblue[1].mid" loop="-1"> 只適用於IE
<embed src="music.mid" autostart="true" loop="true" hidden="true"> 對Netscape ,IE 都適用
滾動
<marquee direction=up height=146 scrollAmount=2>滾動信息
</marquee>
防止點擊空連接時,頁面每每重置到頁首端 代碼「javascript:void(null)」代替原來的「#」標記