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

Detecting sender / focused element in sender?

P: n/a
Hi

I want to open a window using JS, when a button is pressed. In the new
window I'd like to check for which button was pressed.
For cetain reasons, I'd like not to have that in the URL.

What I have is

function whatever(input)
{
win3=window.open("myfile.php?dir=" +
encodeURIComponent(input),"dm_popup","width=500,he ight=550,scrollbars=yes,resizable=yes");
return false;
}

and <p><input name="btn_sel1" type="button" value="..."
onclick="OpenRootDirSel(textbox1.value);">&nbsp;&n bsp;</p>

And here I'd like to add btn2 and textbox2 - which should work the
same way.
The point is, that the new window uses JS too to set the value of the
related textbox.

Any ideas?

WBR
Sonnich
Jan 29 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
jodleren <so*****@hot.eewrites:
Hi

I want to open a window using JS, when a button is pressed. In the new
window I'd like to check for which button was pressed.
For cetain reasons, I'd like not to have that in the URL.
Set it in the opener window:

window.name_of_button = whatever;

then from the new window do:

name_of_button = window.opener.name_of_button;

http://developer.mozilla.org/en/docs/DOM:window.opener

AFAIK this only works for windows that have been opened via window.new()

Joost.
Jan 29 '08 #2

P: n/a
Joost Diepenmaat wrote:
[...]
name_of_button = window.opener.name_of_button;
var ... = ...

And the `opener' property should be tested if it still refers to an open
Window object. See the FAQ.
http://developer.mozilla.org/en/docs/DOM:window.opener

AFAIK this only works for windows that have been opened via window.new()
You would be correct if you meant window.open().
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jan 31 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.