VS2005 弹出页面问题(特急)
//脚本
function openModalWindow(url, arg, width, height)
{
var leftPos = (screen.width - 10 - width) / 2;
var topPos = (screen.height - 60 - height) / 2;
var feast = " ";
if (typeof window.showModalDialog != 'undefined ')
{
feast = "dialogHeight: "+height+ "px;dialogWidth: "+width+ "px; "+ "status:no; ";
window.showModalDialog( "../Public/ShowModalPage.aspx?url= "+url, arg, feast);
}
else
{
feast = "height= "+height+ ",width= "+width+ ",top= "+topPos+ ",left= "+leftPos+ ",fullscreen=0,location=no,menubar=no,resizable=0,scrollbars=no,status=no,toolbar=no,modal=1 ";
var w = window.open( "../Public/ShowModalPage.aspx?url= "+url, arg, feast);
}
}
//ShowModalPage.aspx 页面
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "ShowModalPage.aspx.cs " Inherits= "Public_ShowModalPage " %>
<!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 id= "myTitle " runat= "server "> </title>
</head>
<body style= "margin: 0px " id= "fraParent " runat= "server ">
<form id= "Form1 " method= "post " runat= "server ">
<div>
<iframe id= "fraModalPage " style= "width: 100%; height: 100%; position: absolute; "
runat= "server " scrolling= "auto "> </iframe>
</div>
</form>
</body>
</html>
//ShowModalPage.aspx.cs 代码
protected void Page_Load(object sender, EventArgs e)
{
if (!(Page.IsPostBack))
{
string url = Request.QueryString[ "url "];
string id = Request.QueryString[ "id "];
string custid = Request.QueryString[ "CustID "];
string userid = Request.QueryString[ "UserID "];
string classid = Request.QueryString[ "ClassID "];
string deptid = Request.QueryString[ "DeptID "];
string vendorId = Request.QueryString[ "vendorId "];
string specid = Request.QueryString[ "specid "];
string type = Request.QueryString[ "type "];
string src = url + "?id= " + id + "&custid= " + custid + "&userid= " + userid + "&classid= " + classid + "&deptid= " + deptid + "&vendorId= " + vendorId + "&specid= " + specid + "&type= " + type;
myTitle.Text = src;
fraModalPage.Attributes[ "src "] = src;
}
}
//页面的调用
hkXmmc.Attributes[ "onclick "] = "javascript:void(openModalWindow( '../Qxzx/Qxzx_Xmjd_Grid.aspx&type=kysq ', '520 ', '770 '));document.location.href=document.location.href; ";
注:hkXmmc 是 LinkButton
开发系统用的是XP家庭版,弹出页面是可以正常运行的
在另一台XP专业版的机子上用IIS运行,弹出页面没任何数据显示
各们高手指点指点我这菜鸟
为了这个都快被老板骂死了
[解决办法]
我测试了一下,觉得你的代码有几个要改的地方。
//脚本
function openModalWindow(url, arg, width, height)
{
var leftPos = (screen.width - 10 - width) / 2;
var topPos = (screen.height - 60 - height) / 2;
var feast = " ";
if (typeof(window.showModalDialog) != 'undefined ') <--这里这样写比较规范
{
feast = "dialogHeight: "+height+ "px;dialogWidth: "+width+ "px; "+ "status:no; ";
window.showModalDialog( "../Public/ShowModalPage.aspx?url= "+url, arg, feast);
}
else
{
feast = "height= "+height+ ",width= "+width+ ",top= "+topPos+ ",left= "+leftPos+ ",fullscreen=0,location=no,menubar=no,resizable=0,scrollbars=no,status=no,toolbar=no,modal=1 ";
var w = window.open( "../Public/ShowModalPage.aspx?url= "+url, arg, feast);
}
}
//ShowModalPage.aspx 页面
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "ShowModalPage.aspx.cs " Inherits= "Public_ShowModalPage " %>
<!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 id= "myTitle " runat= "server "> </title>
</head>
<body style= "margin: 0px " id= "fraParent " runat= "server ">
<form id= "Form1 " method= "post " runat= "server ">
<div>
<iframe id= "fraModalPage " style= "width: 100%; height: 100%; position: absolute; "
runat= "server " scrolling= "auto "> </iframe>
</div>
</form>
</body>
</html>
//ShowModalPage.aspx.cs 代码
protected void Page_Load(object sender, EventArgs e)
{
if (!(Page.IsPostBack))
{
string url = Request.QueryString[ "url "];
string id = Request.QueryString[ "id "];
string custid = Request.QueryString[ "CustID "];
string userid = Request.QueryString[ "UserID "];
string classid = Request.QueryString[ "ClassID "];
string deptid = Request.QueryString[ "DeptID "];
string vendorId = Request.QueryString[ "vendorId "];
string specid = Request.QueryString[ "specid "];
string type = Request.QueryString[ "type "];
string src = url + "?id= " + id + "&custid= " + custid + "&userid= " + userid + "&classid= " + classid + "&deptid= " + deptid + "&vendorId= " + vendorId + "&specid= " + specid + "&type= " + type;
myTitle.Text = src;
fraModalPage.Attributes[ "src "] = src;
}
}
//页面的调用
hkXmmc.Attributes[ "onclick "] = "javascript:void(openModalWindow( '../Qxzx/Qxzx_Xmjd_Grid.aspx&type=kysq ', '520 ', '770 '));document.location.href=document.location.href; "; <--这里要改改
写成这样
hkXmmc.Attributes[ "onclick "] = "openModalWindow( '../Qxzx/Qxzx_Xmjd_Grid.aspx&type=kysq ', ' ', '520 ', '770 ');document.location.href=document.location.href; "; <--这里要改改,好像少了一个参数(openModalWindow有四个参数),还有javascript:void不用加,没什么作用。
我这里是vs2005+xp pro调试通过,你回去改完后试试。