1、用JavaScript打开一个模式窗口
//打开登录窗口的模式窗口
function ShowLoginDialog()
{
window.showModalDialog("Default.aspx","newwin","dialogHeight:300px;dialogWidth: 250px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
}
2、打开的Default.aspx页面如下
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
//用JavaScript给服务端的一个按钮注册一个单击事件
function EnterKey(ButtonId)
{
if(event.keyCode==13)
{
$("#"+ButtonId+"").click();
}
}
function bb()
{
self.close();
}
</script>
</head>
<body onkeydown="EnterKey('<%=Button1.ClientID %>')">
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" OnClientClick="bb()"/>
</div>
</form>
</body>
</html>