大致是这么个意思,你多找点AJAX资料看下就知道了 <script type="text/javascript"> var xmlHttp; function createXMLHttpRequest() { if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } }
function startRequest() { var ProvinceID=document.getElementById("DropDownList1"); createXMLHttpRequest(); xmlHttp.onreadystatechange = handleStateChange; var strurl = "?ProvinceID="+ProvinceID.value;//你向一个页面请求 xmlHttp.open("GET", strurl, true); xmlHttp.send(null); }
建议用AJAX或则人员全读到数组,用js来填充人员下拉框,当然这个是在人员记录少的情况下建议
拜托大家给点儿提示,或者给段代码参考一下.
<script type="text/javascript">
var xmlHttp; function createXMLHttpRequest()
{
if (window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
}
function startRequest()
{
var ProvinceID=document.getElementById("DropDownList1");
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
var strurl = "?ProvinceID="+ProvinceID.value;//你向一个页面请求
xmlHttp.open("GET", strurl, true);
xmlHttp.send(null);
}
function handleStateChange()
{
if(xmlHttp.readyState == 4) //0(未初始化);1(正在装载);2 (装载完毕);3 (交互中);4 (完成)
{
if(xmlHttp.status == 200) //200(OK);404(not found)
{//xmlHttp.responseText是服务端返回的结果,你可以以<option>人员1</option>的形式传回也可以只传数据,在JS里解析
document.getElementById("gridiv").innerHTML=xmlHttp.responseText;
}
}
}
</script> <div>
<select ID="DropDownList1" onchange="startRequest()">
<option value=1>部门1</option>
<option value=2>部门2</option>
</select>
</div>
<select id ="gridiv"></select>
。支持每级联动和全部联动
。最小单元格式:[ID,parentID,text] Demo: http://www.v-ec.com/dh20156/code/easyus.html
xmlHttp.responseXML ;
在对xml进行解析 常用的也就是节点的code value两个属性
有的话就把代码贴出来啊!楼上的!我也有同样的问题,发帖都说用AJAX,可这个不太懂啊