我有一个禁用的提交按钮,除非您选择一个选项
如果用户没有选择一个选项,我想要做的是弹出一个警报
我使用单选按钮作为选项
我有以下代码
<form name="choose" action="index.php" method="post" target="_self">
<br />
<fieldset >
<legend class="show_legend">Convert To</legend>
<div class="radio_buttons">
<img alt="" src="images/flv.jpg" class="format_button">
<input name="type" type="radio" class="blue_font" value="flv" onclick="javascript:document.choose.quality.disabled=false;document.choose.audio.disabled=false;document.choose.size.disabled=false;document.choose.OK.disabled=false;"/>
<img alt="" src="images/mp4.jpg" class="format_button">
<input name="type" type="radio" value="mp4" onclick="javascript:document.choose.quality.disabled=false;document.choose.audio.disabled=false;document.choose.size.disabled=false;document.choose.OK.disabled=false;"/>
<img alt="" src="images/wmv.png" class="format_button">
<input name="type" type="radio" value="wmv" onclick="javascript:document.choose.quality.disabled=false;document.choose.audio.disabled=false;document.choose.size.disabled=false;document.choose.OK.disabled=false;" />
<img alt="" src="images/avi.png" class="format_button">
<input name="type" type="radio" value="avi" onclick="javascript:document.choose.quality.disabled=false;document.choose.audio.disabled=false;document.choose.size.disabled=false;document.choose.OK.disabled=false;"/>
<img alt="" src="images/mp3.png" class="format_button">
<input name="type" type="radio" value="mp3" onclick="javascript:document.choose.quality.disabled=true;document.choose.audio.disabled=false;document.choose.size.disabled=true;document.choose.OK.disabled=false;" />
<img alt="" src="images/ogg.png" class="format_button">
<input name="type" type="radio" value="ogg" onclick="javascript:document.choose.quality.disabled=false;document.choose.audio.disabled=false;document.choose.size.disabled=false;document.choose.OK.disabled=false;document.choose.audio.low.disabled=true;"/>
<img alt="" src="images/webm.png" class="format_button">
<input name="type" type="radio" value="webm" onclick="javascript:document.choose.quality.disabled=false;document.choose.audio.disabled=false;document.choose.size.disabled=false;document.choose.OK.disabled=false;"/>
</div>
</fieldset>
<fieldset >
<legend class="show_legend">Optional settings</legend>
<div class="radio_buttons"style="display:inline;padding:10px" >
<br />Video quality:
<select name="quality" class="radio_buttons" disabled="disabled">
<option value="2000000" >high</option>
<option value="1000000">medium</option>
<option value="800000">low</option>
</select>
</div>
<div class="radio_buttons"style="display:inline;padding:10px" >Audio quality:
<select name="audio" class="radio_buttons" disabled="disabled">
<option value="44100" >high</option>
<option value="22050">medium</option>
<option name="low" value="11025" >low</option>
</select>
<div class="radio_buttons"style="display:inline;padding:10px" >Video size:
<select name="size" class="radio_buttons" disabled="disabled" >
<option value="320x240">320x240</option>
<option value="512x384" selected="selected">512x384</option>
<option value="640x360">640x360</option>
<option value="854x480">854x480</option>
<option value="1280x720">1280x720</option>
</select>
</div>
</fieldset>
<div class="radio_buttons">
<input name="OK" type="submit" disabled="disabled" value="" class="send_bt" />
</div>
如果有人点击提交按钮,它不会提交表单或通知用户任何事情
我想提醒用户他不能提交,除非他选择了一个选项