...

View Full Version : How do I pass a parameter from a function to a pop-up window?



ilmus
01-31-2005, 05:23 PM
Hi all,

I'm using a function to open a pop-up window in which the user is asked to fill in a form. I need to set the value of one of the text fields in the form to reflect the place from where the function was called.

I'm using this code to open the pop-up window:

function openpopup2(popurl,hsename){
var winpops=window.open(popurl,"","width=500,height=420 scrollbars=Yes")
}

I want to put the value of hsename in one of the text fields!!!

How can I do this? Any ideas please?

Regards,
ilmus

A1ien51
01-31-2005, 05:56 PM
This may help:

http://radio.javaranch.com/channel/pascarello/2005/01/18.html

Eric

Mr J
01-31-2005, 07:08 PM
There are quite a few ways of transfering data to a popup, one way is


function openpopup2(popurl,hsename){
winpops=window.open(popurl,"","width=500,height=420 scrollbars=Yes")

winpops.document.formName.ElementName.value=hsename

}

but the loading of the popup might not load quick enough before the value is sent

Another way would be to have the popup get the value from the opener when it has loaded


function openpopup2(popurl,hsename){
winpops=window.open(popurl,"","width=500,height=420 scrollbars=Yes")

transferValue=hsename

}

Then in the popups opening body tag

onload="document.formName.ElementName.value=opener.transferValue"

Or you can go down the QueryString route

ilmus
01-31-2005, 08:58 PM
Thanks for your time guys. Mr J's solution worked out nicely.

Regards,

ilmus :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum