...

View Full Version : browser value return



sanbab
03-21-2005, 04:22 PM
i have a html textbox, aside it i have put a <a href> tag which will open a new window.the new window displays a list values which has individual radio button.Last down the document there will be a button named choose.

when i click the button the selected value should be filled in to the previous html text box


please help

afru
03-21-2005, 06:18 PM
Hi,

Here is the code....

page1.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Page 1 </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT LANGUAGE="JavaScript">
<!--
function doOpen(){
WindowObjectReference = window.open("page2.html", "Page2",
"menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
}
//-->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="#FFFFFF">
<input type="text" id="box1" value=""><a href="#" onclick="return doOpen();">Insert Value</a>
</BODY>
</HTML>



page2.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Page2 </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT LANGUAGE="JavaScript">
<!--
function doInsert(){
var radios=document.getElementById("myform").choice;
for(var i=0;i<radios.length;i++){
if(radios[i].checked) opener.document.getElementById("box1").value=radios[i].value;
}
}
//-->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="#FFFFFF">
<form name="myform">
<INPUT TYPE="radio" NAME="choice" value="Hello Good Morning."> Choice 1<br>
<INPUT TYPE="radio" NAME="choice" value="Lets Go to Lunch."> Choice 2<br>
<INPUT TYPE="radio" NAME="choice" value="Good Night Dear."> Choice 3<br>
<INPUT TYPE="button" value="Choose" onclick="doInsert();">
</form>
</BODY>
</HTML>


Have fun :)

Afru.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum