Mon, Jan 25 2010 9:34
In your ASP.NET application, you may want to allow a user to view some additional information without leaving the page that they are on. For example, you may want to display the current window and show some help text in a new window. Or you may want to display the concert ticket order page and allow the user to view the seating chart for the arena in a new window.
winNew = window.open(sURL,sName);
winNew = window.open(sURL, sName,
"toolbar=no, location=no, scrollbars=yes, width=600, height=300,
Notice that all of window attributes are in one string parameter.
To link to a new window, call the OpenWindow function in the a (anchor) element of your HTML as follows:
<a href="BLOCKED SCRIPTOpenWindow('CourseList.htm','CourseList');">
View a list of our courses
To be a good citizen, close the new window when you no longer need it. Here is a function that closes the window:
if (winNew && !winNew.closed)
You may want to call this function from a button that the user can select, or from the unload event for the page so the new window is closed when the user leaves the page:
Use this technique any time you want to open a second window from your HTML page.
(Based on an except from "Doing Web Development: Client-Side Techniques".)