Home  >  Article  >  Web Front-end  >  javascript中onclick(this)用法介绍_javascript技巧

javascript中onclick(this)用法介绍_javascript技巧

WBOY
WBOYOriginal
2016-05-16 17:36:131246browse

this指触发事件的对象

复制代码 代码如下:



复制代码 代码如下:

function test(obj){
alert(obj); //[object HTMLInputElement]
alert(obj.id); //myinput
alert(obj.value); //javascript中onclick中的this
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn