求捉虫!JS跨页面传参失败! 取值不对 你传的是 select 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function openWindow(obj){ window.open('2.jsp?name=' + document.getElementById('list').value ,'_blank'); }另外option元素缺少value属性。 改成这样就成功了,如果用你的方法,需要在哪里添加怎么样的属性?<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title><script type="text/javascript"> function openWindow(obj){ var oSelect = document.all.list; window.open('2.jsp?name=' + oSelect.options[oSelect.selectedIndex].value ,'_blank'); }</script></head><body> <% Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; ArrayList list = new ArrayList(); conn = DBHelper.getMySql(); String sql="select * from format_temp"; try { ps = conn.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()) { list.add(rs.getObject("name")); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } %> <form action="" method="post" name="form1" id="form1"> <select name="listOption" id="list"> <%for(int i=0;i<list.size();i++){%> <option><%=list.get(i).toString()%></option> <%}%> </select> <input type="button" value="修改" onclick="openWindow(form1)"> </form></body></html><body> <% String s = new String(request.getParameter("name").getBytes("ISO-8859-1"),"utf-8"); %> name:<%= s %> </body> 关于java.lang.Integer cannot be cast to java.lang.Long的 疑问 网页运行提示错误:java.lang.Exception: System_DB_ERROR_00019 奇怪问题(在线等待) 用jsp技术怎样实现树形结构? 跳转到本页面 急! 初学者碰到的一个小问题! .net和JAVA区别与联系. 关于hibernate 的二级缓存 用tomcat写servlet,访问数据库怎么做? 个别机器session过期问题 java web项目中,你们是怎样实现文件的上传的啊? javascript提交后如何关闭页面
function openWindow(obj){
window.open('2.jsp?name=' + document.getElementById('list').value ,'_blank');
}另外option元素缺少value属性。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript"> function openWindow(obj){
var oSelect = document.all.list;
window.open('2.jsp?name=' + oSelect.options[oSelect.selectedIndex].value ,'_blank');
}
</script></head>
<body>
<%
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
ArrayList list = new ArrayList();
conn = DBHelper.getMySql();
String sql="select * from format_temp";
try {
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()) {
list.add(rs.getObject("name"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
%> <form action="" method="post" name="form1" id="form1">
<select name="listOption" id="list">
<%for(int i=0;i<list.size();i++){%>
<option><%=list.get(i).toString()%></option>
<%}%> </select>
<input type="button" value="修改" onclick="openWindow(form1)">
</form></body>
</html>
<body>
<% String s = new String(request.getParameter("name").getBytes("ISO-8859-1"),"utf-8"); %>
name:<%= s %> </body>