div怎么添加一个点击事件onClick

div怎么添加一个点击事件onClick,第1张

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />

<title>添加table列</title>

<script type="text/javascript" src="http://www.sz886.com/js/jquery-1.9.1.min.js"></script>

<script type="text/javascript">

$(document).ready(function(e) {

$(".jquery_div").click(function(){

alert("jquery单击")

})

})

function js_click(){

alert("js_单击")

}

</script>

</head>

<body>

<div onclick="js_click()">js_单击</div>

<div class="jquery_div">jquery单击</div>

</body>

</html>

你要隐藏被点击的那个class="dingshuidingdan"的div?那可以在那个div里边添加

<div class="dingshuidingdan" onclick="this.style.display ='none'">

不知道你获取ID的目的是什么?代码里边也没有id啊


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11726187.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存