我想做类似的事情,当我单击单选按钮时,它会转到另一个HTML。
我的代码:
<div class="FilterNetwork">
<div class="network">
<input type="radio" value="Expertise" unchecked name="radioBtn" onclick="expertise.html"> <label> Expertise</label><br>
<input type="radio" value="Location" unchecked name="radioBtn"> <label> Location</label><br>
<input type="radio" value="Workplace" unchecked name="radioBtn"> <label> Workplace </label><br>
<input type="radio" value="Past Job" unchecked name="radioBtn"> <label>Past Job</label><br>
</div>
</div>
答案 0 :(得分:0)
调整onclick属性,例如onclick =“ location.href ='example.html'”。
答案 1 :(得分:0)
您可以创建一个执行以下操作的javascript类:
<div class="FilterNetwork">
<div class="network">
<input type="radio" value="Expertise" unchecked name="radioBtn" onclick="dosomething(Expertise)"> <label> Expertise</label><br>
<input type="radio" value="Location" unchecked name="radioBtn" onclick="dosomething(Location)"> <label> Location</label><br>
<input type="radio" value="Workplace" unchecked name="radioBtn" onclick="dosomething(Workplace)"> <label> Workplace </label><br>
<input type="radio" value="Past Job" unchecked name="radioBtn" onclick="dosomething(PastJob)"> <label>Past Job</label><br>
</div>
</div>
<SCRIPT>
function DoSomething(foo) {
if (foo = 'Expertise') {
window.location.replace("expertise.html");
}
else if (...) {}
else if (...) {}
else if (...) {}
}
</SCRIPT>
这也可以让您在()内传递一个变量,该变量为每个按钮指定不同的操作。干杯