当我鼠标点击那个复选框的时候为什么无法选中呢?

humanblue humanblue 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我加了一个鼠标事件,就是当鼠标在<tr>内时候选中复选框

但是

当我鼠标点击那个复选框的时候为什么无法选中呢?

<html>
<head>
<script type="text/javascript">
// 产品管理鼠标事件
var productMouseDown = function(id)
{
if (document.getElementById('price_' + id).checked == false) {
document.getElementById('price_' + id).checked = true;
}
}
</script>
</head>
<body>
<table>
<tr onmousedown="return productMouseDown(1)">
<td width="150">
¥<input type="checkbox" value="" class="w50" id="price_1">
<span class="manage-p-t">10-01-18</span>
</td>
<td width="150">
ddddddddd
</td>
</tr>
<tr onmousedown="return productMouseDown(2)">
<td width="150">
¥<input type="checkbox" value="" class="w50" id="price_2">
<span class="manage-p-t">10-01-18</span>
</td>
<td width="150">
ddddddddd
</td>
</tr>
<tr onmousedown="return productMouseDown(3)">
<td width="150">
¥<input type="checkbox" value="" class="w50" id="price_3">
<span class="manage-p-t">10-01-18</span>
</td>
<td width="150">
ddddddddd
</td>
</tr>
</table>
</body>
</html>
...全文
评论 11
收藏 已收藏
分享
返回顶部
humanblue
JavaScript 87,983 成员 224,680 内容