By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,624 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,624 IT Pros & Developers. It's quick & easy.

Putting data into a variable from a popup window or frame

P: n/a
I have a javascript where the following line is used prompt the user for
a url.

# szURL = prompt("Enter a URL:", "");

The problem is that I would like to open a php script instead of the
prompt. In that php script the user should then be able to select a link
and the information passed back to the 'szURL' variable.
Is this possible?
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rune Hammerskov wrote:
I have a javascript where the following line is used prompt the user
for a url.

# szURL = prompt("Enter a URL:", "");

The problem is that I would like to open a php script instead of the
prompt. In that php script the user should then be able to select a
link and the information passed back to the 'szURL' variable.


If you now have

szURL = prompt("Enter a URL:", "");
// do something with szURL ...

then use instead of that

window.szURL = -1; // or any other value that indicates no selection
window.open("example.php");
function continue() {
// do something with window.szURL ...
}

and in the document your PHP script creates something like

if (opener
&& !opener.closed
&& typeof opener.continue != "undefined"
&& typeof opener.szURL != "undefined"
) {
opener.szURL = ...
opener.continue();
self.close();
}

See a similar example at
http://www.innoline-systemtechnik.de...op_opener.html

ciao, dhgm
Jul 23 '05 #2

P: n/a
Dietmar Meier wrote:
Rune Hammerskov wrote:
I have a javascript where the following line is used prompt the user
for a url.

# szURL = prompt("Enter a URL:", "");

The problem is that I would like to open a php script instead of the
prompt. In that php script the user should then be able to select a
link and the information passed back to the 'szURL' variable.

If you now have

szURL = prompt("Enter a URL:", "");
// do something with szURL ...

then use instead of that

window.szURL = -1; // or any other value that indicates no selection
window.open("example.php");
function continue() {
// do something with window.szURL ...
}

and in the document your PHP script creates something like

if (opener
&& !opener.closed
&& typeof opener.continue != "undefined"
&& typeof opener.szURL != "undefined"
) {
opener.szURL = ...
opener.continue();
self.close();
}

See a similar example at
http://www.innoline-systemtechnik.de...op_opener.html

ciao, dhgm

Thank you very much, that was exactly what I was looking for.
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.