日期:2014-05-16 浏览次数:20405 次
<script type="text/javascript" language="javascript"> function getV(o){ var _v=''; for(i=0;i<o.length;i++) { if(o[i].checked){_v=o[i].value;break;} } return _v; } function submit(){ var _o1=document.getElementsByName("time"); var _o2=document.getElementsByName("table"); var _o3=document.getElementsByName("count"); var _time=getV(_o1); var _table=getV(_o2); var _count=getV(_o3); if(_time.length==0){alert("请选择就餐时间");return false;} if(_table.length==0){alert("请选择就餐桌位");return false;} if(_count.length==0){alert("请选择就餐人数");return false;} alert("就餐时间:"+_time+";就餐桌位:"+_table+";就餐人数:"+_count); } </script> <input type="radio" name="time" value="时间一" id="t1"/><label for="t1">时间一</label> <input type="radio" name="time" value="时间二" id="t2"/><label for="t2">时间二</label> <input type="radio" name="time" value="时间三" id="t3"/><label for="t3">时间三</label> <br /> <input type="radio" name="table" value="1号桌" id="t4"/><label for="t4">1号桌</label> <input type="radio" name="table" value="2号桌" id="t5"/><label for="t5">2号桌</label> <input type="radio" name="table" value="3号桌" id="t6"/><label for="t6">3号桌</label> <br /> <input type="radio" name="count" value="1-2人" id="t7"/><label for="t7">1-2</label> <input type="radio" name="count" value="3-5人" id="t8"/><label for="t8">3-5</label> <input type="radio" name="count" value="5-8人" id="t9"/><label for="t9">5-8人</label> <br /> <input type="button" onclick="submit()" value="确定" />