打印本文 打印本文 关闭窗口 关闭窗口
Asp.net实用技巧(2)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数4028  更新时间:2009/4/23 10:40:34  文章录入:mintao  责任编辑:mintao
RefreshTargetFrameInSamePage#region RefreshTargetFrameInSamePage
        /**//// <summary>
        /// 从某一框架刷新同一页面中的任意一框架(包括自己所处的框架)
        /// </summary>        
        public static void RefreshTargetFrameInSamePage(HttpResponse Response ,string frameName ,string targetUrl)
        {                
            string scripStr = string.Format("<script language =''''javascript''''> window.parent.{0}.location= ''''" ,frameName) +targetUrl + "''''";
            scripStr += "</"+"script>" ;            
            Response.Write(scripStr) ;
        }
        #endregion 

4.如何调用祖先页面的脚本?

CallAncestorScriptMethod#region CallAncestorScriptMethod
        /**//// <summary>
        /// 调用祖先页面中的某个框架内部page的脚本 ,如果是调用祖先页面的脚本,targetFrameName传入null
        /// </summary>        
        public static void CallAncestorScriptMethod(HttpResponse Response ,string targetPageTitle ,string targetFrameName ,string methodName ,string[] paraStrs)
        {
            StringBuilder scriptString = new StringBuilder();
            scriptString.Append("<script language = javascript>");
            scriptString.Append("var p = window ;");
            scriptString.Append(string.Format("while(p.document.title != ''''{0}'''')" ,targetPageTitle));
            scriptString.Append("{");            
            scriptString.Append("p = p.opener ;");
            scriptString.Append("}");    
            if(targetFrameName != null)
            {
                if(paraStrs == null)

上一页  [1] [2] [3] [4] [5] [6]  下一页

打印本文 打印本文 关闭窗口 关闭窗口