1.如何在单击复选框时设置href
<a href="/Demo/sense/show/4">
<input type="checkbox" />Yes
</a>
<a href="/Demo/sense/list">
<input type="checkbox" />NO
</a>
但是当我勾选复选框时,它不会跳转到另一页。
2.如何在单击“是”文本而不是“是”复选框上设置选中状态。请帮忙,谢谢。
1.如何在单击复选框时设置href
<a href="/Demo/sense/show/4">
<input type="checkbox" />Yes
</a>
<a href="/Demo/sense/list">
<input type="checkbox" />NO
</a>
但是当我勾选复选框时,它不会跳转到另一页。
2.如何在单击“是”文本而不是“是”复选框上设置选中状态。请帮忙,谢谢。
<input type="checkbox" onclick='window.location.assign("/Demo/sense/show/4")'/>是
<input id="cb" type="checkbox" onchange="window.location.href='http://google.com/'">
然后也许需要一个标签:
<label for="cb">Yes</label>
让你的代码简单:
<input type="checkbox" id="chk1" />Yes
<input type="checkbox" id="chk2" />NO
<script type="text/javascript">
$(document).ready(function(){
$('#chk1').click(function(){
window.location='http://www.yahoo.com'; // link of your desired page.
});
});
</script>
<label>
标签即可。只需将您想关联的复选框和文本(在您的情况下为“Yes”)包装起来,然后单击标签或复选框即可切换复选框。例如:<label><input type='checkbox'/>Yes</label>
- enhzflep