这是list页面,我想一进入这页面 那个下拉列表的数据是从数据库查上来的
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ include file="common/common.jsp" %>
<%@ include file="common/head.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>浏览</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/css.css" rel="stylesheet" type="text/css">
<link href="css/register.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action="" method="post">
<select onchange="">
</select>
</form>
<table class="tableborder" align="center" cellpadding="4" cellspacing="1" width="70%">
<tr>
<td colspan="5" class="header" align="center">浏览操作页面</td>
</tr>
<tr>
<td class="altbg1" width="21%">学号</td>
<td class="altbg1">姓名</td>
<td class="altbg1">性别</td>
<td class="altbg1">出生地</td>
<td class="altbg1">班级</td>
<td class="altbg1">操作</td>
</tr>
<c:forEach items="${stuList}" var="s">
<tr>
<td class="altbg2">${s.xh }</td>
<td class="altbg2">${s.xm }</td> <td class="altbg2">${s.xb }</td>
<td class="altbg2">${s.csd }</td>
<td class="altbg2">${s.bj }</td>
<td class="altbg2">
<a href="studentAction.do?status=queryById&id=${s.id }"><font color="red">修改</font></a>
<a href="studentAction.do?status=delete&id=${s.id }" onclick="return confirm('确认删除!')"><font color="red">删除</font></a>
</td>
</tr>
</c:forEach> </table>
<br>
<!--
<script language="JavaScript">
document.register.username.focus();
</script>
--></body>
</html><form action="" method="post">
<select onchange="">
</select>
</form>
想做按省份查询,从数据库中读出放在一下拉列表中
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ include file="common/common.jsp" %>
<%@ include file="common/head.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>浏览</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/css.css" rel="stylesheet" type="text/css">
<link href="css/register.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action="" method="post">
<select onchange="">
</select>
</form>
<table class="tableborder" align="center" cellpadding="4" cellspacing="1" width="70%">
<tr>
<td colspan="5" class="header" align="center">浏览操作页面</td>
</tr>
<tr>
<td class="altbg1" width="21%">学号</td>
<td class="altbg1">姓名</td>
<td class="altbg1">性别</td>
<td class="altbg1">出生地</td>
<td class="altbg1">班级</td>
<td class="altbg1">操作</td>
</tr>
<c:forEach items="${stuList}" var="s">
<tr>
<td class="altbg2">${s.xh }</td>
<td class="altbg2">${s.xm }</td> <td class="altbg2">${s.xb }</td>
<td class="altbg2">${s.csd }</td>
<td class="altbg2">${s.bj }</td>
<td class="altbg2">
<a href="studentAction.do?status=queryById&id=${s.id }"><font color="red">修改</font></a>
<a href="studentAction.do?status=delete&id=${s.id }" onclick="return confirm('确认删除!')"><font color="red">删除</font></a>
</td>
</tr>
</c:forEach> </table>
<br>
<!--
<script language="JavaScript">
document.register.username.focus();
</script>
--></body>
</html><form action="" method="post">
<select onchange="">
</select>
</form>
想做按省份查询,从数据库中读出放在一下拉列表中
不知道你用没没用Struts,如果用了 想让数据绑定到下拉列表那是很简单的事,
eg.<html:select property="province.Id" ">
<html:optionsCollection name="provinceList" label="name" value="id"/>
</html:select>
:~)
<td><small><font face="Verdana">
<html:select property="typename" name="uploadform">
<logic:iterate id="infoListViewEntity" name="uploadform" property="infoList" indexId="i">
<option value="<bean:write name="infoListViewEntity" property="filetype" />">
<bean:write name="infoListViewEntity" property="filetype" />
</option>
</logic:iterate>
</html:select></font></small>
</td>
<c:forEach items="${provincesList}" var="p">
<option>
${p}
</option>
</c:forEach>
</select>
onchange就是选项改变时可以执行指定的js方法,如:
<script>
function test(){
alert("changed");
}
</script><select onchange="test()">
<c:forEach items="${provincesList}" var="p">
<option>
${p}
</option>
</c:forEach>
</select>