p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Code for resizing and closing a window


Message #1 by jiwilliams@c... on Tue, 25 Jun 2002 15:37:50
Hi all,
   Can anyone tell me what the code for opening a new window, resizing it 
and code for closing it from a hyperlink? Thanks.

Jimmy
Message #2 by Greg Griffiths <greg.griffiths@g...> on Tue, 25 Jun 2002 20:40:13 +0100
Check out Javascripts WINDOW.OPEN command, you can close it by using 
WINDOW.CLOSE and depending on the browser you can also resize it

At 15:37 25/06/02 +0000, you wrote:
>Hi all,
>    Can anyone tell me what the code for opening a new window, resizing it
>and code for closing it from a hyperlink? Thanks.
>
>Jimmy


Message #3 by Emily Minier <eminier@d...> on Tue, 25 Jun 2002 09:45:22 -0500
You can use JavaScript to this rather simply.

<script language="JavaScript">
function showRemote() {
self.name="main"; //names current window as "main"

var
windowprops="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbar
s=yes,resizable=yes,width=600,height=400";

OpenWindow=window.open("***Insert URL of Page to Open***","***Insert Title
of Page to Open***",windowprops); //opens window
}

</script>

The properties of the window object used in this example are:

toolbar = 0 for no, 1 yes
location = 0 for no, 1 yes
directories = 0 for no, 1 yes
status = 0 for no, 1 yes
menubar = 0 for no, 1 yes
scrollbars = no or yes
resizable = no or yes
width = # of pixels
height = # of pixels

To close the window, I use a hyperlink on the page and this style of tag <a
href="yourpage.htm" target="main" onClick="window.close()"></a>

The target="main" will cause the link selected to open in the original
window, not the one closing because of the self.name line in the function.

Hope this helps.

Let me know if you need more assistance.

Emily Minier
Technical Coordinator
Dollar Rent A Car Systems, Inc
(xxx) xxx-xxxx


-----Original Message-----
From: jiwilliams@c... [mailto:jiwilliams@c...]
Sent: Tuesday, June 25, 2002 10:38 AM
To: ASP Databases
Subject: [asp_databases] Code for resizing and closing a window


Hi all,
   Can anyone tell me what the code for opening a new window, resizing it 
and code for closing it from a hyperlink? Thanks.

Jimmy

  Return to Index