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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup as the target frame and keeping on top

Status
Not open for further replies.

robert89

Technical User
Nov 19, 2003
125
CA
Hi there,
Is it possible to create a blank htm page and use it as the target when opening another file in a popup window? In other words, the blank.htm becomes the default popup where I can set focus properties and when I create a popup link the associated content opens in the blank.htm page.
Currently I am using the popup routine below. Help appreciated.

<a href="flood.doc" title="Link to Canadian Artist WJ Flood Doc" onclick="window.open('flood.doc', '', 'left=350, top=10, location=yes, menubar=yes, scrollbars=yes, status=yes, resizable=yes, titlebar=yes, height=600, width=500'); return false;" onkeypress="window.open('flood.doc', '', 'left=350, top=10, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, titlebar=no, height=600, width=500'); return false;">

I want to define a popup and use it as the target (frame?) for all my popups.
 
give the window a name, using the second parameter that you've left blank. once you do this, you can reference the window in this manner.

ie...

Code:
var w = window.open('blah.html', 'myWin', '...');

Code:
<a target="myWin" href="blah2.html">click</a>



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Thanks cLFlaVA,
I thought it might be something like that. You made it a bit clearer for me. I'll give it a go.
Thanks again,
Bob
 
Hi CLFlaVA,
Does
var w = window.open('blah.html', 'myWin', '...');
go into the head of the parent page.
 
Hi CLflaVA,
I placed the script in the head and the window opens when I open the parent. So I am doing something wrong. Here's what I have:
a number of links to various files (.docs, mdb, ppt etc.).

I have been asked to have these files open in popups and have that popup stay on top. With my extensive javascript knowledge, and I do not brag here, I can open the documents in a popup window.

This is the problem I am trying to solve and if your script helps do this, would you be kind enough to provide me with a bit more direction.

Greatly appreciated.
Thanks,
Bob

 
i would globally declare w,

Code:
<head>
<script type="text/javascript"><!--
var w;
//--></script>
</head>

and then call your window.open where you normally do...

Code:
<a href="flood.doc" title="Link to Canadian Artist WJ Flood Doc" onclick="window.open('flood.doc', '', 'left=350, top=10, location=yes, menubar=yes, scrollbars=yes, status=yes, resizable=yes, titlebar=yes, height=600, width=500'); return false;" onkeypress="[red]w = [/red]window.open('flood.doc', '[red]myWin[/red]', 'left=350, top=10, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, titlebar=no, height=600, width=500'); return false;">



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top