js-表单验证

<form onsubmit="return checkForm()">
  on?<input id="on" type="radio" name="agree" value="on"/><br/>
  off?<input id ="off" type="radio" name="agree" value="off"/>
  <input type="submit" name="test" />
</form>

 

function checkForm(){
if(document.getElementById("ao").checked)
{
alert('checked');
return true;
}
else
{
alert('not checked');
return false;
}
}

posted on 2017-03-21 19:12  blbl9527  阅读(71)  评论(0)    收藏  举报

导航


github sina微博 FB