JS to implement the parent page to receive the value of the child page __js

Source: Internet
Author: User

One: Parent page

1: Proofing Staff Number text box code:

<input name= "Txtjdry" type= "text" id= "Txtjdry" size= "maxlength=" "readonly=" readonly "value=" ${ REQUESTSCOPE.TXTGETYHBH} "class=" Readonlytext/>

2: Find Number button code:

<input type= "button" Name= "Button2" value= "lookup number" onclick= "Searchcode ()" accesskey= "Q" style= "cursor= ' Hand '" "/>

3: Find the number button called the JS Method: Searchcode (), when clicked on the lookup Number button to pop up the following picture:

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 ();
	}


Two: Child pages

Radio Box Code:

<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: Select one of the radio buttons, click on the Add Number button will be selected to upload the user number to the parent page

The JS code for this page is as follows:

Button buttons:

<input name= "btnquery" type= "button" id= "Btnquery" value= "Add Number" style= "cursor= ' Hand '" "   onclick=" Win () " >
JS Win () method:

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 is the ID of the text box to be displayed in the text box in the parent page
		}
	   Window.close ();
	}
2: When the number button is clicked, the user number in the selected radio box is passed into the text box of the parent page, for example: the check number is 21, the figure is as follows:


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.