469,328 Members | 1,253 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

window.open

Hi,
if I opened a php-page using

... onclick=\"help=window.open('help.php', 'Help',
'innerHeight=400,innerWidth=400,screenX=555,screen Y=250,dependent=Yes,bar=Yes');
....

is there a way to send data to the invoked page (help.php)? Something
like $_POST[....] if I would use a HTML form-submit?
Setting cookies or store data in mysql are not so very elegant solutions.

Can somebody give me hint?

Lajos
Jul 23 '05 #1
2 8819
Just add a query string after help.php:

... onclick=\"help=window.open('help.php?a=10&b=20&c=4 0', 'Help',

'innerHeight=400,innerWidth=400,screenX=555,screen Y=250,dependent=Yes,bar=Ye
s');
...

Hope it helps
Henri

"Lajos Kuljo" <ku***@freemail.hu> a écrit dans le message de
news:o0******************@nntpserver.swip.net...
Hi,
if I opened a php-page using

... onclick=\"help=window.open('help.php', 'Help',
'innerHeight=400,innerWidth=400,screenX=555,screen Y=250,dependent=Yes,bar=Ye
s'); ...

is there a way to send data to the invoked page (help.php)? Something
like $_POST[....] if I would use a HTML form-submit?
Setting cookies or store data in mysql are not so very elegant solutions.

Can somebody give me hint?

Lajos


Jul 23 '05 #2
Lajos Kuljo wrote:
Hi,
if I opened a php-page using

... onclick=\"help=window.open('help.php', 'Help',
'innerHeight=400,innerWidth=400,screenX=555,screen Y=250,dependent=Yes,bar=Yes');
...

is there a way to send data to the invoked page (help.php)? Something
like $_POST[....] if I would use a HTML form-submit?
Setting cookies or store data in mysql are not so very elegant solutions.

Can somebody give me hint?

Lajos


window.open(...) is a GET operation, you can not POST data to the page being opened.
However, you can pass approximately 2Kb of data on the URL itself during the GET
operation:

window.open(
'help.php?a=' + clientSideVariable,
'Help',
'...attributes...'
);

If you actually want to POST data, you're going to have to store it in a form and
POST that form:

<form name="myHiddenForm" method="POST" action="help.php" target="Help">
<input type="hidden" name="myHiddenValue" value="">
</form>
<a href="noJS.html"
onclick="submitForm('myHiddenForm');return false;">Help</a>
<script type="text/javascript">
function submitForm(name) {
var f = document.forms[name];
if (f) {
window.newWindowHtml = [
'<html>',
'<head>',
'<title></title>',
'</head>',
'<body onload="',
'var w;',
'if ((w = window.opener) &&',
'(w = w.document) &&',
'(w = w.forms) &&',
'(w = w[\'' + name + '\'])) {',
'w.submit();',
'}',
'window.focus();',
'">',
'</body>',
'</html>'
].join('\n');
window.open(
'javascript:opener.newWindowHtml',
f.target,
'...attributes...'
);
}
}
</script>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Michael | last post: by
13 posts views Thread by Kai Grossjohann | last post: by
10 posts views Thread by Marshall Dudley | last post: by
2 posts views Thread by Samir Pandey | last post: by
3 posts views Thread by NeverLift | last post: by
14 posts views Thread by D. Alvarado | last post: by
6 posts views Thread by G Dean Blake | last post: by
7 posts views Thread by anthony.turcotte | last post: by
3 posts views Thread by Andrew Poulos | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.