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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass variable to another form

Status
Not open for further replies.

GoTerps88

Programmer
Joined
Apr 30, 2007
Messages
174
Location
US
I have a button that the user clicks to pop up a javascript calendar I created. I'm just using the standard windows.open(url) etc. How can I pass data from the parent form to this popup form?

Thanks...
 
GoTerps, just pass the variables in the URL:

Code:
windows.open(url.asp?MyVariable=Hello)

And then use whatever server side code your using to collect it when the window opens.

Nick
 
Thanks,

But I need to process this variable within the client-side javascript within the popup form or child form. This will not be processed on the server.
 
You can still do this using javascript.

Code:
var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
}

Cheers

Nick
 
Create variables in the parent page to get the data from the popup. Then, from inside the popup push the data into those variables. Something like this:
Code:
var a = 1234;
Code:
parent.window["a"] = 5678

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
Thanks for the replies.

I did this via the child or popup window.

Code:
document.getElementById('txt').value = self.opener.document.forms[0].elements['txtReleaseDate'].value
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top