这个代码怎么改好?

来源:百度知道 编辑:UC知道 时间:2024/06/04 12:06:51
我想实现这样的效果:上面有个下拉框,用户选择其中一个选项的时候,下面的表格会自动改动内容。

表格的内容是根据s_id的不同而变化,所以我需要在用户选择下拉列框后让s_id自动改变值,
并让表格自动根据s_id改变内容

怎么改动我的代码呢?我目前的代码实现不了

<%
Function mesg()
Cmd.parameters.refresh
cmd.CommandText = "list_student"
set rs = cmd.Execute(,array(stu_no))
if not(rs.bof and rs.eof) then
do while not rs.eof
stu_name=stu_name&"<option value="&rs("stu_id")&">"&rs("name")&"</option>"
Rs.Movenext
loop
stu_mess="<select name=s_id onchange='document.getElementById("s_id").value=this.value'>"&stu_name&"</select>"
End if
Cmd.parameters.refresh
End Function

%>

<table border=1 >

选择操作:<%=stu_mess%>

<tr>
<td>姓名</td>
<td>年龄</td>
<

...楼上的两位,别人是ASP的,不是ASP.NET呢。。。
试试这个。。。
1.在该页面设置一个iframe

<iframe height=0 width=0 src="" id="hukoucapitalframe"></iframe>

2.在该页面需要更改控件的地方设置

<span id="load300"></span>
<span id="chukoucapital">
<select name=hukoucapital id="select12">
<option selected>==所在城市==</option>
</select>
</span>

3.下拉框触发一个JS事件传值;

function GethukouCapital(capitalid)
{
document.frames["hukoucapitalframe"].location.replace("inc/changeCapital.asp?capitalid="+capitalid);
}

4.于是值被传入changeCapital.asp,在此页面进行相关数据处理,然后把数据写入控件,替换父页面的控件。
<script>
parent.chukoucapital.innerHTML="";
parent.load300.innerHTML="<select name=hukoucapital onchange=GethukouCity(this.options[this.selectedIndex].value) style='width:70px'><