gpt4 book ai didi

html - 标记为单击链接的复选框

转载 作者:行者123 更新时间:2023-11-28 04:50:08 27 4
gpt4 key购买 nike

好吧,我有一个关于如何在此处制作的问题:

我想在对方点击“Text one”时制作
然后选中“复选框”并在新选项卡中打开链接,“文本二”等也是如此......


图片:

enter image description here

代码:

<form action="demo_form.asp" method="get">
<a href="LinkURL" target="_blank">
<input type="checkbox" name="link1" value="link"> Text one</a>
<br>
<br>
<a href="LinkURL" target="_blank">
<input type="checkbox" name="link2" value="link"> Text two</a>

</form>

最佳答案

尝试标签和jquery

$(document).ready(function(){

$('label[for=link]').on('click', function(){
alert('write here code');
window.location.href= 'http://www.rohitazad.com';
});

$('label[for=link2]').on('click', function(){
alert('write here code 2');
window.location.href= 'http://www.rohitazad.com';
});


});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<form action="demo_form.asp" method="get">

<input type="checkbox" name="link1" value="link" id="link"><label for="link">Text one</label>
<br>
<br>

<input type="checkbox" name="link2" value="link" id="link2"> <label for="link2">
Text two</label>

</form>

关于html - 标记为单击链接的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34632839/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com