Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Detecting sender / focused element in sender? (http://www.velocityreviews.com/forums/t934464-detecting-sender-focused-element-in-sender.html)

jodleren 01-29-2008 07:45 PM

Detecting sender / focused element in sender?
 
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

Joost Diepenmaat 01-29-2008 07:59 PM

Re: Detecting sender / focused element in sender?
 
jodleren <sonnich@hot.ee> writes:

> 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.

Thomas 'PointedEars' Lahn 01-31-2008 11:07 PM

Re: Detecting sender / focused element in sender?
 
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


All times are GMT. The time now is 10:30 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.