javascript中onclick(this)用法介绍

时间:2013-04-19    点击:141   
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
}
jquery 元素控制(追加元素/追加内容)介绍及应用
jQuery弹出(alert)select选择的值
jQuery登陆判断简单实现代码
Jquery submit()无法提交问题
A标签中通过href和onclick传递的this对象实现思路
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved