📄 addresstest.jsp
字号:
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<html:html lang="true">
<head>
<title>addresstest.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body onLoad="TextGet();">
<table width="100%" border="1">
<tr>
<td height="27">
省:
</td>
<td height="27">
<select name="contrry" onchange="TextGet();">
<c:forEach var="MeetroomBen" items="${requestScope.list}">
<option value="${MeetroomBen.aid}">${MeetroomBen.aname}</option>
</c:forEach>
</select>
</td>
</tr>
<tr>
<td height="27">
市:
</td>
<td height="27">
<select name="city">
<option value="all">
该省的所有市
</option>
</select>
</td>
</tr>
</table>
</body>
</html:html>
<script language="javascript">
var xmlHttp;
function createHttpRequest(){
if (window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if (window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
function TextGet(){
createHttpRequest();
var contrry = document.getElementById("contrry").value;
var url = "${pageContext.request.contextPath}/address1.do?praid="+contrry+"&date="+new Date()+"&tag=getsmall";
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange = CallBackGet;
xmlHttp.send();
}
function CallBackGet(){
var result = xmlHttp.responseXML;
if (xmlHttp.readyState == 4){
var userList = result.getElementsByTagName("user");
var userSelect = document.getElementById("city");
userSelect.length = 1;
if (userList.length>0){
for (var i = 0;i<userList.length;i++){
var userBean = userList[i];
var username = userBean.childNodes[0].firstChild.nodeValue;
//加入到下拉框
var option = new Option(username,username);
userSelect.add(option);
}
}
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -