頁面載入順序jQuery
剛才做了一個功能。其他功能中的js方法如下
function PreviwDialogRep(obj) {
var objs = "<%=_strFilePath%>";
//$("#DivPrev").window({
// title: "長期預報",
// width: 800,
// height: 550,
// collapsible: false,
// minimizable: false,
// modal: true
//});
//$("#DivPrev").window('center');
$("#DivPrev").html("<iframe id='RepIfrm' src='../Consultation/ViewPage.aspx?path=" + objs + "></iframe>");
}
後臺程式碼為:
if (!IsPostBack)
{
string strDocName = string.Empty;
DataSet ds = CQYB.GetDocDataSet(null);
if (ds != null && ds.Tables.Count > 0)
{
if (null != ds.Tables[0] && ds.Tables[0].Rows.Count > 0)
{
strDocName = ds.Tables[0].Rows[0]["imgname"].ToString();
//strDocName = ds.Tables[0].Rows[0]["remark1"].ToString();
// string strImgPath = HttpContext.Current.Server.MapPath("~/QueryAnalyse/DOC/TianQiYuBao");
_strFilePath = strDocName;
ClientScript.RegisterStartupScript(this.GetType(), "", "<script>PreviwDialogRep('" + _strFilePath + "');</script>");
}
}
else
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('暫無長期預報!')</script>");
}
}
這種方式無法進入展示SWF的頁面ViewPage.aspx。
之後調整為:
$(document).ready(function () {
var objs = "<%=_strFilePath%>";
$("#DivPrev").html("<iframe id='RepIfrm' src='../Consultation/ViewPage.aspx?path=" + objs + "' width='100%' height='100%'></iframe>");
// $("#DivPrev").html("<iframe id='RepIfrm' src='../Consultation/ViewPage.aspx?path=月底前工作計劃.swf' width='100%' height='100%'></iframe>");
});
原因好像是載入順序不同導致無法進入指定頁面。