📄 index.jsp
字号:
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script type="text/javascript">
var req;
window.onload=function(){
}
function Change_Select()
{
var zhi = document.getElementById('hero').value;
var url = "select?id=" + escape(zhi);
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
}else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if(req){
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}
}
function callback() {
if (req.readyState == 4) {
if (req.status == 200) {
parseMessage();
// update the HTML DOM based on whether or not message is valid
}else{
alert ("Not able to retrieve description" + req.statusText);
}
}
}
function parseMessage() {
var xmlDoc = req.responseXML.documentElement;
var xSel = xmlDoc.getElementsByTagName('select');
var select_root = document.getElementById('skill');
select_root.options.length=0;
for(var i=0;i<xSel.length;i++)
{
var xValue = xSel[i].childNodes[0].firstChild.nodeValue;
var xText = xSel[i].childNodes[1].firstChild.nodeValue;
var option = new Option(xText,xValue);
try
{
select_root.add(option);
}
catch(e)
{
}
}
}
</script>
<body>
<div align="center">
<form name="form1" method="post" action="">
<table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">Double Select Box</td>
</tr>
<tr>
<td><select name="hero" id="hero" onChange="Change_Select()">
<option value="0">Unbounded</option>
<option value="1">D.K.</option>
<option value="2">NEC.</option>
<option value="3">BOSS</option>
</select>
<select name="skill" id="skill">
<option value="0">Unbounded</option>
</select> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -