Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Passing Variables to a popup window

Reply
Thread Tools

Passing Variables to a popup window

 
 
veganeater
Guest
Posts: n/a
 
      01-13-2005
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|


 
Reply With Quote
 
 
 
 
veganeater
Guest
Posts: n/a
 
      01-13-2005

"veganeater" <> wrote in message
news:6_udnTn2Ba9lCnvcRVn-...
> 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.backgrou nd = '#FFFFFF'

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

Argh *pulls hair out*

|veganeater


 
Reply With Quote
 
 
 
 
veganeater
Guest
Posts: n/a
 
      01-13-2005

"veganeater" <> wrote in message
news:rPedneNy_6ICOHvcRVn-...
>
> "veganeater" <> wrote in message
> news:6_udnTn2Ba9lCnvcRVn-...
> > 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.backgrou nd = '#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,men ubar=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>


 
Reply With Quote
 
Mick White
Guest
Posts: n/a
 
      01-14-2005
David Hayes wrote:

> "veganeater" <> wrote in message
> news:6_udnTn2Ba9lCnvcRVn-...
>
>>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)
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Popup Window Popup Timing =?Utf-8?B?Sm9obiBXYWxrZXI=?= ASP .Net 3 11-04-2005 07:33 PM
passing variables to a popup window Ross Javascript 1 08-31-2005 09:17 PM
New Popup Window from an existing Popup Window Raffi Javascript 4 08-12-2004 01:21 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM
passing session variables to popup sumit ASP .Net 1 11-27-2003 11:51 AM



Advertisments