js批量绑定id为 click事件demo

<%@ 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script language="javascript" src="<%=basePath %>js/jquery.min.js"></script>
<script language="javascript" src="<%=basePath %>js/MyQiniu.js"></script>
<title>Insert title here</title>
</head>
<body>
	<input id="11" type="button"/>
	<input id="22" type="button"/>
	<input id="33" type="button"/>
	<input id="44" type="button"/>
	<input id="55" type="button"/>
	<input id="66" type="button"/>
	<script type="text/javascript">
	uu("#11");
	uu("#22");
	uu("#33");
	uu("#44");
	uu("#55");
	</script>
</body>
</html>

MyQiniu.js

	function uu(man){
		$(man).click(function(){
			  alert(man)
			});
	}



猜你喜欢

转载自blog.csdn.net/ppwwp/article/details/82766026