如何根据变量的值改变选择列表的值?

2005-07-25 18:28:56  作者:  来源:互联网  文字大小:】【】【

问:

例如:我做asp文件,内有一列表,选项为“中国”,“美国”,“其它”,
默认为“中国”。

form 提交给此asp文件,同时传送一变量,内容为“美国”,此变量如何影响列表?

答:
<%
  selection=request("myselect")
%>

<select name=myselect>
<option <%if selection="中国" then response.write " selected "%> value="中国">中国</option>
<option <%if selection="美国" then response.write " selected "%> value="美国">美国</option>
<option <%if selection="其他" then response.write " selected "%> value="其他">其他</option>
</select>

相关文章