太久没写JS了,但也不至于这么简单的代码也会出错, 实在是想不通错在哪里function test(){return test;}
test.prototype = {
show : function(f){alert(f)}
}
(new test()).show('d');
报错的是test.prototype = { 这一行,说缺少函数。
test.prototype = {
show : function(f){alert(f)}
}
(new test()).show('d');
报错的是test.prototype = { 这一行,说缺少函数。
解决方案 »
- JavaScript或者JQuery能否选择本机的文件夹路径?
- 急急~~当文本框为Readonly时,如何判断焦点是否获得
- 小问题
- 怎样 用JavaScript 在checkbox 分页后获取前一页选中的checkbox 一并提交
- onMouseOver 下拉列表 当光标在页面文本框中的时候,下拉列表不能自动消失? (刚才那个帖子出错打不开了!咋回事儿??!)
- 如何在被iframe的页面,取得iframe它的页面的一个元素!
- jquery如何给<opiton>添加事件?
- onload,有没有时间可以控制,也就是显示中间页面很短,或者中间页面对客户是不可见的!谢谢
- 简单问题,下拉菜单select怎么能默认状态为index=-1(高分求教).
- 自动按下网页上SUMBIT按钮(急)
- div+css+js 实现文章的分页功能?
- 为什么加了DOCTYPE声明,这段代码就没用了
test.prototype = {
show : function(f){alert(f)}
}
new test().show('d');
Function.prototype.show = function(f) { alert(f); }
var x = new test();
(new test()).show('d');
test.prototype = {
show : function(f){alert(f)}
}
new test().show('licai1210');
//(new test());别乱用,各种执行,理解了就好了,如果加了()就不再是new test()对象了,应该是object对象了
alert(typeof((new test())))会告诉你答案
test.prototype = {
show : function(f){alert(f)}
}
var a = new test();
a.show('d');这样就好了