一:父页面
1:校对人员编号文本框代码:
<input name="txtJDRY" type="text" id="txtJDRY" size="10" maxlength="40" readonly="readonly" value="${requestScope.txtGetYhbh }" class="ReadonlyText"/>
2:查找编号按钮代码:
<input type="button" name="Button2" value="查找编号" onClick="SearchCode()" accesskey="Q" style="cursor='hand'"/>
3:查找编号按钮所调用的js方法:SearchCode(),当点击查找编号按钮之后弹出如下图片:
function SearchCode(){ var wndMEPImgPreView=window.open("<%=basePath%>cxaction.do?action=cxJDRY","wndMEPImgPreView","toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600,left=200,top=200"); wndMEPImgPreView.focus(); }
二:子页面
单选框代码:
<c:forEach items="${listUsers}" var="message" varStatus="index"> <tr onMouseOver="this.style.background='#ececec'" onMouseOut="this.style.background='#ffffff'" style="cursor='hand'"> <td align="center"><input type="radio" id="txtGetYhbh" name="txtGetYhbh" value="${message.yhbh}" /></td> <td align="center">${message.yhbh}</td> <td align="center">${message.yhmc}</td> <td align="center">${message.zsxm}</td> </tr> </c:forEach>
1:选中其中的一个单选按钮,点击添加编号按钮会将选中的用户编号传到父页面
其中这个页面的js代码如下:
button按钮:
<input name="btnquery" type="button" id="btnquery" value=" 添加编号 " style="cursor='hand'" onclick="win()">js win()方法:
function win(){ var radios = document.getElementsByTagName("input"); for(var i = 0 ;i<radios.length ; i++){ if(radios[i].type=="radio" && radios[i].checked){ window.opener.document.getElementById("txtJDRY").value=radios[i].value;//txtJDRY是要显示在父页面中那个文本框里的文本框的id } } window.close(); }2:当点击添加编号按钮之后,会将你选中的单选框中的用户编号传入父页面的文本框中 例如:选中编号为21,图如下: