this指触发事件的对象
实现代码如下:

<input id="myinput" type="text" value="javascript中onclick中的this" onclick="javascript:test(this);"/>

实现代码如下:

function test(obj){
alert(obj); //[object HTMLInputElement]
alert(obj.id); //myinput
alert(obj.value); //javascript中onclick中的this
}

以上就是【javascript中onclick(this)用法介绍】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论