我有以下单选按钮:
<div id="radiobuttons" class="container" name="buttons" align=center>
<h2>I Want my Building to be Made of:</h2>
<ul>
<li>
<input type="radio" id="brick-option" name="material" value="1" onClick="choose('bricks')">
<label for="brick-option">Bricks</label>
<div class="check"></div>
</li>
<li>
<input type="radio" id="wood-option" name="material" value="3" onClick="choose('wood')">
<label for="wood-option">Wood</label>
<div class="check">
<div class="inside"></div>
</div>
</li>
<li>
<input type="radio" id="stone-option" name="material" value="2" onClick="choose('stone')">
<label for="stone-option">Stone</label>
<div class="check">
<div class="inside"></div>
</div>
</li>
</ul>
</div>
<form action="chooseheight.html">
<div class="wrapper">
<button class="button" onClick="changechanceoflive();test()" align=center>Submit</button>
</div>
</form>
当用户点击该按钮时,它将转到下一页。虽然,我不希望他们在没有选中其中一个按钮的情况下进入下一页。帮助
答案 0 :(得分:0)
-XX:MaxPermSize=50g -XX:+HeapDumpOnOutOfMemoryError -Xmx50g -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=100.100.100.100 -Dcom.sun.management.jmxremote.port=5006 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
&#13;
function validate() {
if (document.querySelectorAll('input[type="radio"]:checked').length < 1) {
alert('Please select at least one.');
return false;
}
alert('Success');
// document.forms['myform'].submit;
}
&#13;