首页的 Page_load
protected void Page_Load(object sender, EventArgs e)
{
List<Article> curPopupNoticeList = ArticleData.GetPopupNotice("中心公告");
int top = 0;
int left = 0;
int height = 10;
int width = 360;
int stepSize = 50;
foreach (Article popupNotice in curPopupNoticeList)
{
top += stepSize;
left += stepSize;
string script =
"<script language=javascript>window.open('PopupNotice.aspx?ArticleID=";
script += popupNotice.ArticleID + "', ";
script += "'" + "title" + popupNotice.ArticleID + "', '";
script += "height=" + height + ",";
script += "width=" + width + ",";
script += "top=" + top + ",";
script += "left=" + left + ",";
script += "toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')</script>";
Response.Write(script);
}
}
{
List<Article> curPopupNoticeList = ArticleData.GetPopupNotice("中心公告");
int top = 0;
int left = 0;
int height = 10;
int width = 360;
int stepSize = 50;
foreach (Article popupNotice in curPopupNoticeList)
{
top += stepSize;
left += stepSize;
string script =
"<script language=javascript>window.open('PopupNotice.aspx?ArticleID=";
script += popupNotice.ArticleID + "', ";
script += "'" + "title" + popupNotice.ArticleID + "', '";
script += "height=" + height + ",";
script += "width=" + width + ",";
script += "top=" + top + ",";
script += "left=" + left + ",";
script += "toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')</script>";
Response.Write(script);
}
}
弹出页面的脚本
<head runat="server">
<title></title>
<script>
function window.onload()
{
//var obj = document.getElementById("DivNoticeFrame");
var obj = document.documentElement;
window.resizeTo(360, obj.scrollHeight + 40);
}
</script>
</head>
<title></title>
<script>
function window.onload()
{
//var obj = document.getElementById("DivNoticeFrame");
var obj = document.documentElement;
window.resizeTo(360, obj.scrollHeight + 40);
}
</script>
</head>
浙公网安备 33010602011771号