monotoba
12-12-2003, 03:12 PM
Hello all, I am new to JavaScript programming and I am looking for a way to provide a popup window containing an html file to be displayed for site subscribers. My JavaScript is being included in a php file.
At the moment I have three files:
1. nmemeber.php -- Checks to see if the user is registered and includes nmember.js if they are not.
2. nmember.html -- my html message to non subscribers.
3. nmember.js -- This is where I'm having trouble... This file opens a window, sets the timeout period and call function.
The object is to open a new popup window every 'x' seconds if one is not already open. If a window is open, then bring the window to the foreground. If the user has closed the popup window, then re-open it.
My code looks like this:
**Note: the line "pwindow.closed() causes an error stating that this method is not supported... and does not function!
--------------------------------------------------------------------
var pwindow;
var tim;
function nmember_timeout()
{
// display the popup
//popupwindow=window.setTimeout("nmember_timeout()", 60000);
if((!pwindow) || (pwindow.closed()))
{
pwindow=window.open("templates/popup_member.html","", "top = 40, left= 40, width=500, height=450, scrollbars");
}
else
{
pwindow.focus();
}
// set the interval
window.setTimeout("nmember_timeout()", 30000);
}
nmember_timeout();
----------------------------------------------------------------------
Thanks for your help with this...
At the moment I have three files:
1. nmemeber.php -- Checks to see if the user is registered and includes nmember.js if they are not.
2. nmember.html -- my html message to non subscribers.
3. nmember.js -- This is where I'm having trouble... This file opens a window, sets the timeout period and call function.
The object is to open a new popup window every 'x' seconds if one is not already open. If a window is open, then bring the window to the foreground. If the user has closed the popup window, then re-open it.
My code looks like this:
**Note: the line "pwindow.closed() causes an error stating that this method is not supported... and does not function!
--------------------------------------------------------------------
var pwindow;
var tim;
function nmember_timeout()
{
// display the popup
//popupwindow=window.setTimeout("nmember_timeout()", 60000);
if((!pwindow) || (pwindow.closed()))
{
pwindow=window.open("templates/popup_member.html","", "top = 40, left= 40, width=500, height=450, scrollbars");
}
else
{
pwindow.focus();
}
// set the interval
window.setTimeout("nmember_timeout()", 30000);
}
nmember_timeout();
----------------------------------------------------------------------
Thanks for your help with this...