javascript 经常用的一些特殊效果
1. 让文字不停的滚动。
<marouee>滚动文字</marouee>
2.记录并显示网页的最后修改时间
<script language="javascript">
doucument.write("最后更新时间:" + document.lastModified + " ")
</script>
3.添加到收藏夹
<script language="javascript">
function bookmarkit() {
window.external.addFavorite('http://你的网址','你的网站名称');
}
if(document.all)
document.write('<a href="#" onClick="bookmarkit()">加入收藏夹</a>');
</script>
4.设置该页为首页
<body bgcolor="#FFFFFF" text="#000000">
<!--网址:http://你的网址-->
<a class="chlnk" style="cursor:hand"
href onClick="this.style.behavior='url(#default#homeapge)';this.setHomePage('你的网站名称);"><font color="000000" size="2" face="宋体">设为首页</font></a>
//未完。。。明天继续
相关文档:
prototype精彩资料:
"javascript之prototype" http://www.cnblogs.com/zouhaijian/archive/2009/03/29/1424592.html(很简约但清晰的讲述了prototype的用途)
"JavaScript对象模型-执行模型" http://w ......
如何屏蔽javascript的错误信息:
只要在页面中加入如下代码即可:
<SCRIPT LANGUAGE='JavaScript'>
<!--
//屏蔽js错误
function ResumeError() {
return true;
}
window.onerror = ResumeError;
// -->
</SCRIPT> ......
1 一起困惑始于变量的作用域
请先看下面的代码:
示例1:
var message = " this is a very simple function ";
function simpleFunc(){
alert(message);
}
背后的道理大家都懂(如果不懂的可以先别往 ......
/* 方法:Array.remove(dx)
* 功能:删除数组元素.
* 参数:dx删除元素的下标.
* 返回:在原数组上修改数组
*/
//经常用的是通过遍历,重构数组.
Array.prototype.remove=function(dx)
{
if(isNaN(dx)||dx>this.length){return false;}
for(var i=0,n=0;i<this.length;i++)
{
......
<!doctype html>
<html lang="zh-ch">
<head>
<meta charset="utf-8" />
<meta content="IE=8" http-equiv="X-UA-Compatible"/>
<title>mousewheel的事件绑定 by 司徒正美</title>
<mce:script type="text/javascript"><!--
window. ......