<mce:script type="text/javascript"><!-- // 对象定义 function user(){ // 注意创建的格式,一定要使用this 不然js会把它当做一个全局变量来使用 this.uid="1"; this.name="bruce"; this.showName = function(){ alert(this.name); } } // 创建对象 var u = new user(); u.showName(); u.name="lee"; u.showName(); // --></mce:script>