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

Link in popup window 2

Status
Not open for further replies.

Boomerang

Programmer
Mar 30, 2001
766
NL
Hi,

When a user comes at my site I start a popup window with the next code. The session("loaded") is to open the popup window only once at the first hit). :

My site has 3 frames. <body <%call PopUp%> ..... is in the mainframe.
Now I want to make a link in the popup window that startups a page in the mainframe in the ORIGINAL browser and automattically make the popup window disappear.

Please help!

Erik

here is my code
----------------------------------------------------------
Code:
<body <%call    PopUp%>  .....

function PopUp()
 if session(&quot;loaded&quot;) <> 1 then
		Response.Write(&quot;onLoad=&quot;&quot;window.open('../homepage/popup_vac.asp', 'popup_vac', 'top=200,left=100,height=300,width=300');&quot;&quot;&quot;) 
		session(&quot;loaded&quot;) = 1
	end if
end function
----------------------------------------------------------
 
You could use client-side script in the Link_OnClick event (or you could use a button). Here is an example (keep in mind that I use VBScript):

Sub Link_OnClick()

'This navigates the opener of the popup to a new page
Window.Opener.Navigate &quot;NewPage.htm&quot;

'This closes the popup window
Window.Close

End Sub

I hope this helps.
Rich
 
javascript solution is

window.opener.location='whatever';
window.close();
penny.gif
penny.gif
 
Hi Paul,

Please help me with the syntax of the link <a href=??? ...> IN the popup window to open a page in the ORIGINAL browser that is at the background. Remember: the originale browser started the popup window.

Erik
 
<a href=&quot;javascript:eek:penLocation('locationYouWant.asp');&quot;>Click here to open it in the parent window</a>

<script language=javascript>
function openLocation(url){
window.opener.location = url;
window.close();
}
</script>

So that for the href, you are not calling a link, but rather, the javascript function, 'openLocation', and then sending it your url for where you want the parent to go. When a user clicks on the link, it will call the function, the function will change the location of the parent window, and then close the popup.

good luck! :)
Paul Prewett
penny.gif
penny.gif
 
Hi Guys,

:) You make me smile again LOL

Rich, I choose for the javascript option cause I want to be sure it works in NN, but thanks anyway!

Paul, it works perfect, just how I wanted it to work !!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top