js 与jquery 同时绑定一个ID onclink事件

事例代码:
javascript

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>   
<head>
<title>shortLink</title>
</head>
<script  src="http://localhost:8090/short_link/js/jquery/jquery-1.8.3.min.js"></script>//引入jquery框架
<script type="text/javascript">

$(document).ready(function(){
 $("#test").click(function(){
  alert("你好");
 });
 $("#test").click(function(){
      alert("你好2");
     });
});
function dd(){
    alert("dd!");
}
function dd(){
    alert("dd2");
}
function aa(){
    alert("aa!");
}
</script>
<body>
  <h1>哈哈</h1>
  <input id="test" type="button" value="肯定" onclick="dd();aa();"/>
</body>
</html>
html

相应结果:java

dd2    aa!  你好 你好2jquery

总结:框架

从结果中看出;htm

1)js 多个同名响应事件,仅会执行最后一个事件

2)onclink绑定多个事件,会以从左到右顺序执行ip

3)jquery 绑定事件屡次,屡次都会执行,且会在JS事件以后执行input

相关文章
相关标签/搜索