注册 登录
编程论坛 ASP技术论坛

[求助]如何初始化 radio 按纽

afliult 发布于 2007-08-29 09:38, 802 次点击

各位前辈,本人在编程时碰到一个问题,
在下面 asp 代码中

<html>
<head>
<title>修改学生</title>

<%
dim name,sex
name="张三"
sex="男"
%>

</script>
</head>

<body>

<table >
<form >
<tr bgcolor="#F6F6F6">
<td><font color="#333333">姓名:</font></td>
<td> <font color="#333333">
<input name="stuname" type="text" class="input" value="<%=name%>">
</font></td>
</tr>

<tr bgcolor="#F6F6F6">
<td><font color="#333333">性别:</font></td>
<td> <font color="#333333">

<input type="radio" name="stusex" value="1" checked >

<input type="radio" name="stusex" value="2" checked>

</font></td>
</tr>


</form>
</table>
</body>
</html>

以上代码,如何根据 sex 的值,初始化 radio 按纽,
当 sex 为男是 左边按纽选中
当 sex 为女时 右边按纽选中

2 回复
#2
Mycr2007-08-29 09:44


<input type="radio" name="stusex" value="1" <% if sex="男"then Response.write "checked" %>>

<input type="radio" name="stusex" value="2" <% if sex!="男"then Response.write "checked" %>>

#3
afliult2007-08-29 11:15
谢谢这位大师,现在有用了.
1