<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery模拟鼠标点击事件-示例</title>
<script type="text/javascript" src="http://www.daimajiayuan.com/templets/skins/js/jquery-1.8.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function(){
$("#div1").click(function(){
});
$("#div2").click(function(){
$("#a").trigger("click");//模拟执行id=div1的事件
});
});
</script>
</body>
<div id="a" style="width:40px; height:40px; background-color:#74d;">div1</div>
<div id="b" style="width:40px; height:40px; background-color:#74d7cb; margin:30px 30px;">div2</div>
</html>
js模拟点击事件
最新推荐文章于 2024-08-17 11:12:57 发布