日期:2014-05-17 浏览次数:21380 次
<% '取数据 gender= "女" married = "未婚" %> <script> window.onload = function(){ var gender= "<%=gender%>"; var married = "<%=married%>"; var a = document.forms[0].elements["性别"]; for(var i=0;i<a.length;i++){ if(a[i].value==gender){a[i].checked=true;break;} } a = document.forms[0].elements["婚姻状况"]; for(var i=0;i<a.length;i++){ if(a[i].value==married){a[i].checked=true;break;} } } </script> <form> <input type='radio' name='性别' value="男">男 <input type='radio' name='性别' value="女"> 女 <input type='radio' name='婚姻状况' value='已婚'>已婚 <input type='radio' name='婚姻状况' value='未婚'>未婚 <input type='radio' name='婚姻状况' value='离异'>离异 </form>