0

I want to pop up a new page in the main page of my application . The location must be in center,can't be sizable, it shouldn't be opened as a new tab in the main page , the bar with the options for : closing,minimize/miximize shouldn't be there.

Here is my code:

  protected void Page_Load(object sender, EventArgs e)
        {
           HyperLink1.Attributes.Add("onclick", "window.open('WebForm1.aspx',null,'height=350, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=center,menubar=no')");
        }

But....

  • It's sisable,location is not in not in the center of the page.

  • The page is opened in the main page but as a new tab.

  • I don't know how to remove the bar with : closing,maximize,minimize

Can someone help me?

Thanks

4

1 回答 1

1

Try this:

protected void Page_Load(object sender, EventArgs e)
        {
           HyperLink1.Attributes.Add("onclick", "centeredPopup('WebForm1.aspx','myWindow','500','300','yes');return false");
        }


<script language="javascript">
var popupWindow = null;
function centeredPopup(url,winName,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
popupWindow = window.open(url,winName,settings)
}
</script>

For more details - see this

于 2012-07-12T12:27:40.733 回答