<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
(function() {
var object = function() {};
var ooo = {};
ooo.sh = {};
var i = 0;
object.showName = function() {
alert(i);
};
object.prototype.setName = function() {
i = 9999999999999999999999999999999;
};
ooo.sh.showName = function() {
alert(i);
};
window.obj = object;
window.ooo = ooo;
})();
window.obj.setName();
ooo.sh.showName();
</script>
</head><body>
</body>
</html>
为什么没运行呢
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
(function() {
var object = function() {};
var ooo = {};
ooo.sh = {};
var i = 0;
object.showName = function() {
alert(i);
};
object.prototype.setName = function() {
i = 9999999999999999999999999999999;
};
ooo.sh.showName = function() {
alert(i);
};
window.obj = object;
window.ooo = ooo;
})();
window.obj.setName();
ooo.sh.showName();
</script>
</head><body>
</body>
</html>
为什么没运行呢
解决方案 »
- getComponentVersion函数的用法
- 【请教高手:js如何获得父页面url】
- 请问半年日期差值怎么算啊?
- 求助,这个功能怎么在javascript中实现?
- EXT的gblPageTabObject
- 把相对路径转变为绝对路径.答对立刻给分.
- 奇怪的javascript问题,不知你碰到过没有?
- 请教"mailto:"问题
- 请问,如何使用JScript历遍整个表单?
- ERROR in Entry module not found: Error: Can't resolve 'js/home.js' in 'C:\Users\
- jqgrid4.52用的jqery-ui-custom-css文件版本用1.8.2的可否?
- 在jqgrid中inline eidting模式中,如何实现切换行保存数据替代"esc"键?
改成
window.obj = new object();
没有 new 实例它只是个函数,实例后 prototype 属性才会有