Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change window properties of current window

Status
Not open for further replies.

kodiekillian

Programmer
Jun 23, 2004
6
US
I am using javascript to build some computer base training. I want to turn off all the browser menus, toolbars, scrollbars etc, along with making it fullscreen. I have only figured out how to do this with a pop-up window. I open the original window in order to call javascript to pop-up a window with these attributes; but then I have two windows open (the first is no longer serving a purpose).

Is there a way to open one window with those attributes that I want with out popping up a window? or how do I use one button in the pop-up window to close both of the windows(the pop-up (and ultimatly the workspace) is a frameset)at once.

I am trying to minimise the work that the user has to do to get out of the CBT. Thanks

 
how do I use one button in the pop-up window to close both of the windows(the pop-up (and ultimatly the workspace) is a frameset)at once

This will do what you ask...

Code:
<script type="text/javascript">
function closeWin()
{
  this.opener.close(); // closes the opener window
  this.close(); // closes the current window
}

And you might use something like this to trigger it:
Code:
<a href="javascript:closeWin();">Close window</a>

Or even:
Code:
<input type="button" onclick="closeWin()" value="Close window" />

The user will get an alert from the browser though... and there is nothing that you can really do about this.

Jeff
 
I have been able to get this to work in a nornal window but the pop-up is a Frameset with a top frame and a left side navigation frame and the main frame. So the close button will be in the nav.html frame which is inside the index.html. Unless there is someway to put a button in the frameset that is in the index.html. Thanks
 
I have been able to get this to work in a nornal window but the pop-up is a Frameset

So does this mean that it worked or not?

You might find that use of top.window.close() (instead of just window.close()) is better for you in this instance.

Jeff
 
No. It did not work in the frame. I am popping up the index.html but it does not have <body> since it is a frameset. I have to put the close button in one of the frames. I guess I just don't know have to reference the hierchy to get to the opener.
 
I am now able to close the index (frameset) from inside the frame by using

window.parent.close();

and then can close the calling window by

window.parent.opener.close();

This works out fine unless there is a way to just make the original window use the features I want in the first place without having to pop-up a window.

Thanks for your help

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top