order.jsp界面代码:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html>
<head>
<title>Simple jsp page</title>
<script type="text/javascript">
function callBackOrderName(a) {
document.getElementById("order.orderName").options.length = 0;
for (i=0; i<a.length;i++) {
document.getElementById("order.orderName").add(a[i]);
}
}
function listOrderName(){
listName.location = "listOrderName.do";
}
function openWindow() {
window.open("listOrderItem.do", null,null);
}
function callBackOrderItem(item){
alert(item);
document.getElementById("orderItem").value = item;
}
function InputEtc(){
var a = prompt("请输入中文");
alert(a);
document.getElementById("orderEtc").value=a;
}
</script>
</head>
<body>Place your content here
<iframe id="listName" name="listName" width="0" height="0"></iframe>
<html:form action="/submitOrder" >
<table>
<tr>
<td>order code</td>
<td>
<html:select property="order.orderCode" οnchange="listOrderName();">
<html:option value="Y">Male</html:option>
<html:option value="N">Female</html:option>
</html:select>
</td>
</tr>
<tr>
<td>order name</td>
<td>
<html:select property="order.orderName">
<html:option value="select">select</html:option>
</html:select>
</td>
</tr>
<tr>
<td>order date</td>
<td><html:text property="order.orderDate"></html:text></td>
</tr>
<tr>
<td>order code</td>
<td>
<html:hidden property="orderItem"></html:hidden>
<input type="button" id="btn" name="btn" οnclick="openWindow();" width="40" value="选择项目">
</td>
</tr>
<tr>
<td>order code</td>
<td>
<html:hidden property="orderEtc"></html:hidden>
<input type="button" id="btne" name="btne" οnclick="InputEtc();" width="40" value="选择项目">
</td>
</tr>
</table>
<html:submit>ok</html:submit>
</html:form>
</body>
</html>
listOrderName.jsp代码:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Simple jsp page</title>
<script type="text/javascript">
var a = new Array();
a[0] =new Option("ok", "ok");
a[1] =new Option("cancel", "cancel");
window.parent.callBackOrderName(a);
</script>
</head>
<body>Place your content here</body>
</html>