【父页面代码】
1、html部分
<cw:textArea property="stBidContent" id="stBidContentId" maxLength="1000" label="申办类容" width="210" height="60" readOnly="true"/>
<a href="#" οnclick="openBidContent()">
2、script部分
function openBidContent(){
var s=document.getElementById("stBidContentId").innerHTML;
ocwindow('cert_bid_content_show.action?s=' + s,'addReqContent',500,600);
}
【子页面代码】
1、html部分
<%
List<String> lst = (List<String>)request.getAttribute("allBidContentLst");
if(lst !=null){
for(String str:lst){
%>
<tr height="30">
<td>
<input type="checkbox" name="bidContent" value="<%=str%>" /><%=str%>
</td>
</tr>
<%} }%>
2、script部分
一、 <body οnlοad="init()">
function init(){
var s = window.opener.document.getElementById("stBidContentId").innerHTML;
var arrSelected = s.split(",");
var arrAllInput = document.getElementsByTagName("input");
for(var i=0;i<arrAllInput.length;i++){
for(var j=0;j<arrSelected.length;j++){
if(arrAllInput[i].getAttribute("value") == arrSelected[j]){
arrAllInput[i].setAttribute("checked","true");
break;
}
}
}
}
二、<input name="close" type="button" class="button02_14"
οnclick="closeWin()" value="关 闭" />
function save(){
var r=document.getElementsByName("bidContent");
var s='';
for(var i=0;i<r.length;i++){
if(r[i].checked){
s += r[i].value + ',';
}
}
if(s.length>0){
s = s.substr(0,s.length-1);
}
window.opener.document.getElementById("stBidContentId").innerHTML = s;
window.close();
}