Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass values between browsers 2

Status
Not open for further replies.

CoolClark

MIS
Mar 9, 2001
352
US
Is there a way to pass values from one instance of a browser to another using DHTML? If I have a text box in Browser A I want to fill it from a text box in Browser B when a button in Browser B is pushed.

Browser A

<HTML>
<HEAD>
</HEAD>
<BODY>
<form id=BrowserA>
<INPUT type=&quot;text&quot; id=textA name=textA>
</form>
</BODY>
</HTML>

Browser B

<HTML>
<HEAD>
</HEAD>
<BODY>
<form id=BrowserB>
<INPUT type=&quot;text&quot; id=textB name=textB>
</form>
<INPUT type=&quot;button&quot; value=&quot;Button&quot; id=button1 name=button1>
</BODY>
</HTML>

<SCRIPT LANGUAGE=vbscript>
<!--
sub button1_onclick()
'send browserB.textB to browserA.textA
end sub
//-->
</SCRIPT>
 
I think you might have better luck if you posted this in a DHTML type of forum. A Server-side method (mixed with some clientside) , would be to session the value (or pass in URL) refreshing the window you want to update (assuming the window has been assigned a name) Karl Blessing aka kb244{fastHACK}
kblogo.jpg
 
If you have a parent-child relationship between the two browsers, it's fairly simple. Here's an example:

browser a page:
Code:
<html>
<head>
<title>Test</title>
<script language=&quot;javascript&quot;>
function openMe(){
  var x = window.open('newOne.htm', 'newWindow', 'height=300,width=300');
}
</script>
</head>
<body>
<form name=theForm>
<INPUT type=button value=&quot;Open It&quot; name=submit1 onClick=&quot;openMe();&quot;>
<input type=text name=theBox>
</form>
</body>
</html>

browser b page:
Code:
<html>
<head>
<title>testing</title>
<script language=javascript>
  function setOther(){
    window.opener.theForm.theBox.value = document.myForm.thisBox.value;
  }
</script>
</head>
<body>
<form name=myForm>
  <input type=text name=thisBox>
  <input type=button value=&quot;Click Me&quot; onClick=&quot;setOther();&quot;>
</form>
</body>
</html>

Now all that does is when you click the button, it opens up the new page in a pop up window, and when you type something in the text box in the pop up, and push that button, it assigns that value back to the text box on the original page. From this example, though, it's easy to see how to communicate between the two windows.

good luck! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top