Passing Variables to a popup window

V

veganeater

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

veganeater

veganeater said:
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
 
V

veganeater

veganeater said:
info
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>
 
M

Mick White

David said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top