R
Robert Mark Bram
Hi All!
Is there a way to reference a window by name without doing something like
this:
open (, 'windowName');
The open method will open a blank window if there is no window with such a
name.
I am trying to organise a navigation structure between two windows with
content from the same host.. I have been trying the following:
The 'content pages' link back to the menu with this:
<a href="main.asp" onClick="return openMenuWindow(this.href);" >enter</a>
And the 'menu page' links to various content pages with this:
<a href="content.asp" onClick="return openContentWindow(this.href);"
The functions are below.My latest problem is that the links are opening up
in the same page, rather than two pages. However, I have a sneaking
suspicion that I am trying too hard and the correct technique is much
simpler.
Any advice on how to get these two windows talking to each other would be
most welcome!
var contentWindow = null;
// Menu window should use this function to open a content window.
function openContentWindow (pageUrl)
{
if (contentWindow != null &&
String(contentWindow.location) == pageUrl)
{
contentWindow.focus();
return false;
} // end if
contentWindow = window.open (pageUrl, "contentWindow");
contentWindow.menuWindow = window;
contentWindow.focus();
} // end openContentWindow function
// Content window should use this function to open a menu window.
function openMenuWindow (pageUrl)//(pageUrl, pageName, w, h, scroll, pos)
{
if (window.menuWindow != null &&
!window.menuWindow.closed)
{
window.open (, 'main').focus();
return;
} // end if
var pageName = 'main';
var w = '800';
var h = '450';
var scroll = 'no';
var pos = 'center';
window.name="contentWindow";
var LeftPosition=(screen.width)?(screen.width-w)/2:100;
var TopPosition=(screen.height)?(screen.height-h)/2:100;
var settings=
'width='+w+
',height='+h+
',top='+TopPosition+
',left='+LeftPosition+
',scrollbars='+scroll+
',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
var menuWindow = window.open (pageUrl, pageName, settings);
menuWindow.focus();
return false;
} // end openContentWindow function
Rob
Is there a way to reference a window by name without doing something like
this:
open (, 'windowName');
The open method will open a blank window if there is no window with such a
name.
I am trying to organise a navigation structure between two windows with
content from the same host.. I have been trying the following:
The 'content pages' link back to the menu with this:
<a href="main.asp" onClick="return openMenuWindow(this.href);" >enter</a>
And the 'menu page' links to various content pages with this:
<a href="content.asp" onClick="return openContentWindow(this.href);"
enter</a>
The functions are below.My latest problem is that the links are opening up
in the same page, rather than two pages. However, I have a sneaking
suspicion that I am trying too hard and the correct technique is much
simpler.
Any advice on how to get these two windows talking to each other would be
most welcome!
var contentWindow = null;
// Menu window should use this function to open a content window.
function openContentWindow (pageUrl)
{
if (contentWindow != null &&
String(contentWindow.location) == pageUrl)
{
contentWindow.focus();
return false;
} // end if
contentWindow = window.open (pageUrl, "contentWindow");
contentWindow.menuWindow = window;
contentWindow.focus();
} // end openContentWindow function
// Content window should use this function to open a menu window.
function openMenuWindow (pageUrl)//(pageUrl, pageName, w, h, scroll, pos)
{
if (window.menuWindow != null &&
!window.menuWindow.closed)
{
window.open (, 'main').focus();
return;
} // end if
var pageName = 'main';
var w = '800';
var h = '450';
var scroll = 'no';
var pos = 'center';
window.name="contentWindow";
var LeftPosition=(screen.width)?(screen.width-w)/2:100;
var TopPosition=(screen.height)?(screen.height-h)/2:100;
var settings=
'width='+w+
',height='+h+
',top='+TopPosition+
',left='+LeftPosition+
',scrollbars='+scroll+
',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
var menuWindow = window.open (pageUrl, pageName, settings);
menuWindow.focus();
return false;
} // end openContentWindow function
Rob