<script language="JavaScript">
<!--
function MyObject(){
var _firstName; //对象局部变量
this.name=""; //对象public变量
if(arguments.length>0){
this.name=arguments[0];
_firstName=this.name.split(" ")[0];
}
this.getName=function(){
return this.name;
}
this.getFirstName=function(){
return _firstName;
}
}
var obj =new MyObject("Electric Communities");
alert("FullName:"+obj.getName()+"/nFirstName:"+obj.getFirstName());
//-->
</script>
私有变量一般加前缀_,所以编写自己的js时,变量避免使用_开头,以免与js内置变量冲突。
========================================================
http://www.javascript.com/
http://javascript.internet.com/
web组件:http://www.bindows.net (基于IE)
Client-Side JavaScript Reference
JS-X.com Store
http://www.js-x.com/javascript/core_js15/ix.php