日期:2014-05-16 浏览次数:20455 次
var LIB = function () { var _request1 = function () { this._name = "alert request1 name!"; this._id = "alert request1 id!"; }; var _request2 = new function () { this._name = "alert request2 name!"; this._id = "alert request2 id!"; }; return { request1: _request1, request2: _request2 }; } (); function jst() { var tt1 = new LIB.request1();//正常 //var tt2 =LIB.request2();//这里会报错 alert(tt1._name);//正常 //alert(tt2._name);//访问不了 }
<input type="button" id="btn_test" style="width:120px;height:30px" value="测试" onclick="jst()" />