您的位置:首页 > Web前端 > JQuery

页面加载顺序jQuery

2014-06-29 14:02 176 查看
刚才做了一个功能。其他功能中的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>");

        });

原因好像是加载顺序不同导致无法进入指定页面。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: