Passing Variables to a popup window

Discussion in 'Javascript' started by veganeater, Jan 13, 2005.

  1. veganeater

    veganeater Guest

    Hi Everyone,

    I was wondering if there was a way to pass a variable to a popup window. The
    purpose is make it so when a user clicks on a specific region/link of the
    glossary page, a popup opens with the related description. This is done and
    is obviously not a concern. However, now I would like to make it so the
    corresponding row becomes highlighted (changes background colour via DOM).

    I imagine it can be done, but I'm at a loss for finding any relevant info on
    the net as so far.

    If someone could help me out, or point me in the right direction, I would
    really appreciate it :)

    Thanks.
    |veganeater|
     
    veganeater, Jan 13, 2005
    #1
    1. Advertising

  2. veganeater

    veganeater Guest

    "veganeater" <> wrote in message
    news:...
    > Hi Everyone,
    >
    > I was wondering if there was a way to pass a variable to a popup window.

    The
    > purpose is make it so when a user clicks on a specific region/link of the
    > glossary page, a popup opens with the related description. This is done

    and
    > is obviously not a concern. However, now I would like to make it so the
    > corresponding row becomes highlighted (changes background colour via DOM).
    >
    > I imagine it can be done, but I'm at a loss for finding any relevant info

    on
    > the net as so far.
    >
    > If someone could help me out, or point me in the right direction, I would
    > really appreciate it :)
    >
    > Thanks.
    > |veganeater|
    >
    >

    Okay, So I normally try to avoid posting a reply to myself, but....

    Working with the following script reference has shown me that I'm not just
    day dreaming - it can be done, I just still don't know how to ref setting a
    style.background mod to a specific referenced id.

    eg: document.getElementsById(something).style.background = '#FFFFFF'

    where the ID should be related to the corresponding <tr id="n"> in the popup
    HTML

    Argh *pulls hair out*

    |veganeater
     
    veganeater, Jan 13, 2005
    #2
    1. Advertising

  3. veganeater

    veganeater Guest

    "veganeater" <> wrote in message
    news:...
    >
    > "veganeater" <> wrote in message
    > news:...
    > > Hi Everyone,
    > >
    > > I was wondering if there was a way to pass a variable to a popup window.

    > The
    > > purpose is make it so when a user clicks on a specific region/link of

    the
    > > glossary page, a popup opens with the related description. This is done

    > and
    > > is obviously not a concern. However, now I would like to make it so the
    > > corresponding row becomes highlighted (changes background colour via

    DOM).
    > >
    > > I imagine it can be done, but I'm at a loss for finding any relevant

    info
    > on
    > > the net as so far.
    > >
    > > If someone could help me out, or point me in the right direction, I

    would
    > > really appreciate it :)
    > >
    > > Thanks.
    > > |veganeater|
    > >
    > >

    > Okay, So I normally try to avoid posting a reply to myself, but....
    >
    > Working with the following script reference has shown me that I'm not just
    > day dreaming - it can be done, I just still don't know how to ref setting

    a
    > style.background mod to a specific referenced id.
    >
    > eg: document.getElementsById(something).style.background = '#FFFFFF'
    >
    > where the ID should be related to the corresponding <tr id="n"> in the

    popup
    > HTML
    >
    > Argh *pulls hair out*
    >
    > |veganeater
    >
    >

    Okay, NOW I feel like a dumbass.... here's the code I was talking about:

    <script type="text/javascript">
    var newwindow = '';

    function popUp(url)
    {
    if (!newwindow.closed && newwindow.location)
    {
    newwindow.location.href = url;
    }
    else
    {
    newwindow=window.open(url, 'popup1',
    'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=8
    00,height=500,left = 500,top = 350');
    if (!newwindow.opener) newwindow.opener = self;
    }
    if (window.focus) {newwindow.focus()}
    return false;
    }
    </script>
     
    veganeater, Jan 13, 2005
    #3
  4. veganeater

    Mick White Guest

    David Hayes wrote:

    > "veganeater" <> wrote in message
    > news:...
    >
    >>I was wondering if there was a way to pass a variable to a popup window.

    >
    > The
    >
    >>purpose is make it so when a user clicks on a specific region/link of the
    >>glossary page, a popup opens with the related description. [..]

    >
    >
    > Rather than pass a variable TO the pop-up window, why not pass it so that it
    > is READ BY the pop-up window.
    >
    > What's worked for me is to place into the first window some displayforms to
    > hold the variable. So that these are not seen by the visitor, you set them
    > to "hidden":
    >
    > <FORM NAME="displayForm">
    > <INPUT TYPE=hidden NAME="initValue" VALUE="X0p1">
    > <INPUT TYPE=hidden NAME="prodValue" VALUE="0">
    > <INPUT TYPE=hidden NAME="examValue" VALUE="0.1">
    > <INPUT TYPE=hidden NAME="frmcnt" VALUE=1>
    > <INPUT TYPE=hidden NAME="rve" VALUE="R">
    > </FORM>
    >
    > Within the pop-up, set it up that it doesn't begin work on the variables
    > until the window is sufficiently loaded. You do this by specifying within
    > the <BODY> tag onLoad=yourFunction().
    >
    > Within yourFunction(), call the variable when you need it:
    > var chpsct = firstwindow.document.displayForm.initValue.value;


    Normally:

    var chpsct = opener.document.displayForm.initValue.value;

    Mick
    >
    > --
    > David Hayes
    >
    > (remove the name of the programming language from email address to make it
    > usable)
    >
    >
     
    Mick White, Jan 14, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sumit
    Replies:
    1
    Views:
    447
  2. =?Utf-8?B?Sm9obiBXYWxrZXI=?=

    Popup Window Popup Timing

    =?Utf-8?B?Sm9obiBXYWxrZXI=?=, Nov 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    848
    =?Utf-8?B?Sm9obiBXYWxrZXI=?=
    Nov 4, 2005
  3. Jens Peter Hansen
    Replies:
    7
    Views:
    548
    Randy Webb
    Jun 19, 2004
  4. Raffi
    Replies:
    4
    Views:
    231
    Dr John Stockton
    Aug 12, 2004
  5. Ross
    Replies:
    1
    Views:
    97
    Randy Webb
    Aug 31, 2005
Loading...

Share This Page