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.a sp" onClick="return openContentWind ow(this.href);"[color=blue]
>enter</a>[/color]
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 openContentWind ow (pageUrl)
{
if (contentWindow != null &&
String(contentW indow.location) == pageUrl)
{
contentWindow.f ocus();
return false;
} // end if
contentWindow = window.open (pageUrl, "contentWindow" );
contentWindow.m enuWindow = window;
contentWindow.f ocus();
} // end openContentWind ow function
// Content window should use this function to open a menu window.
function openMenuWindow (pageUrl)//(pageUrl, pageName, w, h, scroll, pos)
{
if (window.menuWin dow != null &&
!window.menuWin dow.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="co ntentWindow";
var LeftPosition=(s creen.width)?(s creen.width-w)/2:100;
var TopPosition=(sc reen.height)?(s creen.height-h)/2:100;
var settings=
'width='+w+
',height='+h+
',top='+TopPosi tion+
',left='+LeftPo sition+
',scrollbars='+ scroll+
',location=no,d irectories=no,s tatus=no,menuba r=no,toolbar=no ,resizable=no';
var menuWindow = window.open (pageUrl, pageName, settings);
menuWindow.focu s();
return false;
} // end openContentWind ow 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.a sp" onClick="return openContentWind ow(this.href);"[color=blue]
>enter</a>[/color]
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 openContentWind ow (pageUrl)
{
if (contentWindow != null &&
String(contentW indow.location) == pageUrl)
{
contentWindow.f ocus();
return false;
} // end if
contentWindow = window.open (pageUrl, "contentWindow" );
contentWindow.m enuWindow = window;
contentWindow.f ocus();
} // end openContentWind ow function
// Content window should use this function to open a menu window.
function openMenuWindow (pageUrl)//(pageUrl, pageName, w, h, scroll, pos)
{
if (window.menuWin dow != null &&
!window.menuWin dow.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="co ntentWindow";
var LeftPosition=(s creen.width)?(s creen.width-w)/2:100;
var TopPosition=(sc reen.height)?(s creen.height-h)/2:100;
var settings=
'width='+w+
',height='+h+
',top='+TopPosi tion+
',left='+LeftPo sition+
',scrollbars='+ scroll+
',location=no,d irectories=no,s tatus=no,menuba r=no,toolbar=no ,resizable=no';
var menuWindow = window.open (pageUrl, pageName, settings);
menuWindow.focu s();
return false;
} // end openContentWind ow function
Rob
:)
Comment