導航:首頁 > 編程語言 > java二級聯動

java二級聯動

發布時間:2023-01-23 18:52:12

java二級聯動,怎樣在選了前面一個之後,後面的也跟著動

java中要實現二級聯動,應該使用ajax技術,實例如下:

varreq;
functionchooseEmp()
{

varemp=document.getElementById('empId');

varurl="MagEmp?emp="+escape(emp.value);
if(window.XMLHttpRequest){
req=newXMLHttpRequest();
}elseif(window.ActiveXObject){
req=newActiveXObject("Microsoft.XMLHTTP");
}
if(req){
req.open("GET",url,true);
req.onreadystatechange=callback;
req.send(null);
}
}

functioncallback()
{
if(req.readyState==4)
{
if(req.status==200)
{
parseMessage();
}else{
alert("Notabletoretrievedescription"+req.statusText);
}
}
}

functionparseMessage()
{
varxmlDoc=req.responseXML.documentElement;
varxSel=xmlDoc.getElementsByTagName('select');
varselect_root=document.getElementById('magId');
select_root.options.length=0;

for(vari=0;i<xSel.length;i++)
{
varxValue=xSel[i].childNodes[0].firstChild.nodeValue;
varxText=xSel[i].childNodes[1].firstChild.nodeValue;
varoption=newOption(xText,xValue);
try{
select_root.add(option);
}catch(e){
}
}
}
閱讀全文

與java二級聯動相關的資料

熱點內容
山科女生程序員 瀏覽:745
mybatis3源碼分析 瀏覽:455
華為交換機常用配置命令 瀏覽:375
程序員怎麼去銀行上班 瀏覽:589
廣州程序員薪資 瀏覽:888
win7命令提示符輸入 瀏覽:592
關於程序員的故事 瀏覽:482
吃雞伺服器是什麼樣的 瀏覽:19
為什麼pspice沒有單片機 瀏覽:6
高數第六版下冊答案pdf 瀏覽:904
sm3演算法實現java 瀏覽:675
只有程序員才懂的笑話 瀏覽:267
php開發app介面源碼 瀏覽:12
加密狗寶寶 瀏覽:237
單片機搶答器的原理 瀏覽:928
百利達體脂儀可以用什麼app連接 瀏覽:227
伺服器2016自動備份怎麼取消 瀏覽:844
dos攻擊命令大全 瀏覽:843
夢世界伺服器怎麼擴大領地 瀏覽:972
解壓breathe 瀏覽:437