<script>function test(){
this.show = function(x){
obj[x] = this;
var i=1;
document.write('<input type=button value=test onclick="obj[\''+ x + '\'].test1(i);">');
} this.test1 = function(c){
alert(c);
alert("Hello World!");
}
}
var obj = new Object();
var x = new test();
x.show("nihao");
</script>
怎么将onclick="obj[\''+ x + '\'].test1(i)中的i传递到this.test1 = function(c) c中?
遇到瓶颈了,项目进行不下去了
this.show = function(x){
obj[x] = this;
var i=1;
document.write('<input type=button value=test onclick="obj[\''+ x + '\'].test1(i);">');
} this.test1 = function(c){
alert(c);
alert("Hello World!");
}
}
var obj = new Object();
var x = new test();
x.show("nihao");
</script>
怎么将onclick="obj[\''+ x + '\'].test1(i)中的i传递到this.test1 = function(c) c中?
遇到瓶颈了,项目进行不下去了
解决方案 »
- 如何取默认的式样(StyleSheet CSS)值?
- js解密!!!!
- div中有两个input控件,怎样让这两个控件在div居中显示
- div如何定位到鼠标附近
- 请教各位:DIV固定宽度并小于其包含的Table,Table位置改变后如何求其偏移量(有例子)
- 求助:如何区分访问站点的设备是android还是androidpad?
- JS高手请进,如何做这样的切换效果?
- 在一个网页(a.jsp)上按一个按扭,打开一个小页面(b.jap)(没有状态拦,工具拦和地址拦),我想实现在小页面上按一个按钮,小页面关闭,
- 有谁知道Server端JavaScript?
- 一个下拉列表中无选项时,如何控制它的宽度?
- alert("p">"h")返回true,Why?
- jquery中$是指什么意思?
<script>function test(){
this.show = function(x){
obj[x] = this;
var i=1;
document.write('<input type="button" value="test" onclick="obj[\''+ x + '\'].test1(' + i +');">');
}
this.test1 = function(c){
alert(c);
alert("Hello World!");
}
}
var obj = new Object();
var x = new test();
x.show("nihao");
</script>
就跟前面的obj的索引一样