View Full Version : How do I create a pop-up on my page.
07-09-2004, 03:53 PM
I have a question? How do you make a page (When Opened) open up into a smaller box compared to taking up the entire window. Basically I need to know how to create a popup window for my page to remind users of new features. Would I need to use Java or something and what would the code look like? My page is written in HTML. Any help would be greatly appreciated
The basic codeis
So using a button would go
<input type="button" Value="Open New Window" ONCLICK="window.open('targetpage.htm','win1','width=300,height=300')">
and as a link
<A HREF="#null" ONCLICK="window.open('Your Page.htm', 'win2','width=300,height=100,left=450,top=250,toolbar=yes')">Your Link</A>
For more information see here
07-09-2004, 07:02 PM
Great, It worked!!! thanks for your help
07-09-2004, 07:17 PM
One more question is there a way to have a button to close a window and if so what would it look like?
Would this button be in the parent or the popup?
07-09-2004, 09:02 PM
Parent page is where I wanted the close window feature. I found it on that website link you gave me. Now is there a way to code it so that it does not give the prompt "The webpage you are viewing is trying to close the window". Other than that the code below works great.
Close Window Code:
<A HREF="#null" onclick="window.close(-1); return false"></A>
In order to reference the popup from the parent you have to give the popup a name.
<a href="#null" onclick="mywin=window.open('yourpage.htm','','left=200,top=200,width=300,height=300')">Open</a>
<a href="#null" onclick="mywin.close()">Close</a>
07-09-2004, 10:00 PM
I want the user to have the ability to close the main page itself. Would I need in essence to turn the main page into a pop-up and reference the main page name then use the close feature?
The following is classed as a work round to suppress the message shown when trying to close the parent window in that instance.
The script is placed in the parent page
window.opener = top;
<a href="#null" onclick="close_win()">Close</a>
07-09-2004, 10:56 PM
For a second there it was no working then I looked at what the function the link was calling and there was a "." were a "_" was supposed to be. I got it to work, It works great thanks for all of your help.
07-12-2004, 10:46 AM
As Mr. J pointed out, that's a workaround. He's right because that's actually a bug exploit. Meaning, it might not work in the future if the bug is fixed.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.