刷新引起的问题
问题描述:我通过前台调用后台方法实现下拉列表框联动,虽然实现了联动,但我发现不能对其进行编程(一旦触发一个会引起回传的事件,之前做的联动就没有了)
前台代码:
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function ajx() {
var ddl = document.getElementById("ddl");
var ddlcon = document.getElementById("ddlcon");
var dss = coptmng.Getds(ddl.value.toString());//调用后台方法得到一个dataset
setlist(dss);
}
function setlist(response){
if (response != null) {
var ds = response.value; // 返回集
var list = document.getElementById("ddlcon");
var dl = document.getElementById("ddl");
list.length = 0;
if (ds != null && typeof (ds) == "object" && ds.Tables != null)
{
for (var i = 0; i < ds.Tables[0].Rows.length; i++) {
if (dl.value == "机房名") {
var option = document.createElement("OPTION");
option.value = ds.Tables[0].Rows[i].jname;
option.text = ds.Tables[0].Rows[i].jname;
list.add(option);
}
if (dl.value == "地点") {
var option = document.createElement("OPTION");
option.value = ds.Tables[0].Rows[i].place;
&nbs