<input id="a" onclick="f(this)" value="a" type=button><input id="b" onclick="f(this)" value="b" type=button><script>f(obj){
//如何判断是哪个按钮调用次方法
alert(this.value);
}
</script>或者
e = window.event;
var obj = e.srcElement;
alert(obj.value);
//如何判断是哪个按钮调用次方法
alert(this.value);
}
</script>或者
e = window.event;
var obj = e.srcElement;
alert(obj.value);
alert(this.value);
改成
alert(obj.value);
onclick = onclick(2)
不可以么?