新手,获取第二个下拉框中的值并显示行下方!
<body>
<center>
<h2>信息表</h2>
<s:form action="" method="post">
<s:doubleselect
id="sel"
name="shengfen"
label="请选择"
list="{'水果','广东','性别'}"
doubleName="name"
doubleList="top=='水果'?{'苹果','雪梨','葡萄'}:(top=='广东'?{'深圳','广州','佛山'}:{'男','女'})"
labelposition="top">
</s:doubleselect>
</s:form>
<div id="div"></div>
</center>
</body>
就是选中第二个下拉框之后,页面无刷新的在div中显示:你选中的是。。。
------解决方案--------------------
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'csdn.jsp' starting page</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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" language="javascript">
function show(){
var sel=document.getElementById("sel").value;
var sel2=document.getElementById("sel2").value;
document.getElementById("div").innerHTML="你选中的是 "+sel+" 中的 "+sel2;
}
window.onload=function(){
window.setInterval("show()",200);
}
</script>
</head>
<body>
<center>
<h2>信息表</h2>
<s:form name="form" action="" method="post">
<s:doubleselect id="sel" name="shengfen" label="请选择"
list="{'水果','广东','性别'}" doubleId="sel2" doubleName="name"
doubleList="top=='水果'?{'苹果','雪梨','葡萄'}:(top=='广东'?{'深圳','广州','佛山'}:{'男','女'})"
labelposition="top" onclick="show();">
</s:doubleselect>
</s:form>
<div id="div"></div>
</center>
</body>
</html>