Not a Member Yet,
Click here to Register

ID: 67
Viewed: 3918
Added: Jan 29, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

One window sometimes just isn't enough. For instance, you might want to create a window as a secondary navigation aid. Pop-up windows are straightforward to make with the Window.open method.

This method takes four optional parameters:

Location specifies the URL of the document to show within the new window. If it's left blank, the "about:blank" document (a blank document) is displayed.

Name specifies the name of the new window.

Options is a single string containing a series of comma-delimited parameters that specify how the new window will look.

Replace history item, if set to true, won't add a new history item to the browser's history list as a result of the window opening.

The following example shows how you can both open and close a navigation window from an HTML page.

<!---Head--->
<SCRIPT language="vbscript"> 

'Dim a local variable to hold a reference to the new window.
Private oNavWin

Function OpenNavWindow()
'Call the open method and assign the resultant window reference to your local variable.
Set oNavWin = Window.open("nav.html","navwindow", _
"height=150,width=250, _
status=yes,toolbar=no, _
menubar=no,location=no")
'Pass a reference to this window to the new window.
Set oNavWin.opener = self
End Function

Function CloseNavWindow()
'Handle an error, just in case the
'window has already been closed!
on error resume next
'Close the window.
oNavWin.Close()
'Release the object reference.
Set oNavWin = Nothing
End Function

</SCRIPT>

<!---Body--->


 <CENTER>
<H2>Main window</H2>
<P>
<input type="button" name="cmdClose" onClick="CloseNavWindow" value="Close navigation window">
<P>
<input type="button" name="cmdOpen" onClick="OpenNavWindow" value="Open navigation window">
</CENTER>


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!