码迷,mamicode.com
首页 > 其他好文 > 详细

this event 使用

时间:2015-05-03 18:43:50      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link href="" rel="stylesheet" type="text/css">
<script type="text/javascript">
function dada( evt ){
var obj = event.target;
var s = obj.value;
obj.value = parseFloat(s) + 1;

}
</script>
</head>
<body>
<input type="button" value="1" id="btn1" onclick="dada(event)"/>
<input type="button" value="1" id="btn2" onclick="dada(event)" />
<input type="button" value="1" id="btn3" onclick="dada(event)"/>
</body>
</html>

________________________________________
this


<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link href="" rel="stylesheet" type="text/css">
<script type="text/javascript">
function dada( myInput ){
myInput.value = parseFloat(myInput.value) + 1;
}
</script>
</head>
<body>
<input type="button" value="1" id="btn1" onclick="dada(this)"/>
<input type="button" value="1" id="btn2" onclick="dada(this)" />
<input type="button" value="1" id="btn3" onclick="dada(this)"/>
</body>
</html>

this event 使用

标签:

原文地址:http://www.cnblogs.com/havoe/p/4474280.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!