indow.event.returnValue=false onselectstart=event.returnValue=false>
30.大 中 小 文字的变化
<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>
30.添加到收藏夹和设为首页
<a href=# onclick="this.style.behavior=''url(#default#homepage)''; this.setHomePage(''http://www.makewing.com/lanren/'');">设为首页</a>
<a href="javascript:window.external.AddFavorite(''http://www.makewing.com /lanren/'',''懒人图库'')">收藏本站</a>
31.记录并显示网页的最后修改时间
<script language=JavaScript>
document.write("最后更新时间: " + document.lastModified + "")
</script>
32.节日倒计时
<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>
33.打开窗口即最大化
<script language="JavaScript">
<!-- Begin
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
// End -->
</script>
34.加入背景音乐
<bgsound src="mid/windblue.mid" loop="-1"> 只适用于IE
<embed src="music.mid" autostart="true" loop="true" hidden="true"> 对Netscape ,IE 都适用
35.滚动
<marquee direction=up height=146 onmouseout=start() onmouseover=stop() scrollAmount=2>
滚动信息
</marquee>
36.防止点击空
链接时,页面往往重置到页首端
代码“javascript:void(null)”代替原来的“#”标记
37.不能点右键,不用CTRL+A,不能复制作!
<body oncontextmenu="window.event.returnValue=false"
onkeypress="window.event.returnValue=false"
onkeydown="window.event.returnValue=false"
onkeyup="window.event.returnValue=false"
ondragstart="window.event.returnValue=false"
onselectstart="event.returnValue=false">
</body>
37.随机变换背景图象(一个可以刷新心情的特效)
<Script Language="JavaScript">
image = new Array(4); //定义image为
图片数量的数组
image [0] = ''tu0.gif'' //背景图象的路径
image = ''tu1.gif''
image = ''tu2.gif''
image = ''tu3.gif''
image = ''tu4.gif''
number = Math.floor(Math.random() * image.length);
document.write("<BODY BACKGROUND="+image[number]+">");
</Script>
38.划过链接 手型鼠标
style="cursor:hand"
39.如何关闭层
<div id="Layer1"></div>
<a href="#" onClick="Layer1.style.display=''none''">关闭层</a>
40.<a href=javascript:close()>[关闭窗口]</a>
41.凹陷文字背景为灰色
<div style="width:300px;padding:20px;overflow:hidden;word-wrap:break-word;word-break:break:all; font-size:12px; line-height:18px; background-color:#eeeeee;">
<font disabled>
怎么样,我凹下去