Wednesday, September 8, 2010

Opening a new window without toolbar, menu bar, etc. like a popup with width and height set to prefered size

Use java script open method for the above effect.

Syntax : oNewWindow = object.open( [sURL] [, sName] [, sFeatures] [, bReplace])  

sURL (Optional): String that specifies the URL of the document to display. If no URL is specified, a new window with about:blank is displayed.

sName (Optional):  String that specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.

sFeatures (Optional) :Optional. String that contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following features are supported.


bReplace (Optional) : Boolean that specifies whether the sURL creates a new entry or replaces the current entry in the window's history list. This parameter only takes effect if the sURL is loaded into the same window. 
true
sURL replaces the current document in the history list
false
sURL creates a new entry in the history list.
 
ex:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Page1</title>
    <script type ="text/javascript" >
    function OpenPopupWindow()
    {
          window.open("Page2.aspx","","toolbar=no,location=no, status = yes,   menubar=no,scrollbars=no, width =500, height = 300");
               
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:LinkButton ID="lnkPage2" runat="server" OnClientClick = "OpenPopupWindow();" >Page2</asp:LinkButton>
   
    </div>
    </form>
</body>
</html>

For a complete reference Click Here

No comments:

Post a Comment