using System;
using System.Web;

namespace Luo
{
    
/// <summary>
    
/// 客户端提示信息重载列表


    
/// Msg:打印的消息
    
/// Url:重定向地址
    
/// </summary>

    public class Messages
    
{
        
//Pring(1)
        public static string Print(string Msg)
        
{
            
return "<p align=center><a href='javascript:location.reload();'>" + Msg + "</a></p>";
        }

        
//Pring(2)
        public static string Print(string Msg, string Url)
        
{
            
return "<p align=center><a href='" + Url + "'>" + Msg + "</a></p>";
        }


        
//Alert(1)
        public static string Alert(string Msg)
        
{
            
string re = "";
            Msg 
= Msg.Replace("'""\\'");
            Msg 
= Msg.Replace("\n""\\n");
            re 
= "<script language='JavaScript' type='text/javascript'>";
            re 
= re + "alert('" + Msg + "');";
            re 
= re + "window.history.back();";
            re 
= re + "</script>";
            
return re;
        }

        
//Alert(2)
        public static string Alert(string Msg, string Url)
        
{
            
string re = "";
            Msg 
= Msg.Replace("'""\\'");
            Msg 
= Msg.Replace("\n""\\n");
            re 
= re + "<script language='JavaScript' type='text/javascript'>";
            re 
= re + "alert('" + Msg + "');";
            
//re = re + "parent.basefrm.location='" + Url + "';";
            re = re + "window.location='" + Url + "';";
            re 
= re + "</script>";
            
return re;
        }


        
//Alert(3)
        public static string Alert(string Msg, string Url, int type)
        
{
            
string re = "";
            Msg 
= Msg.Replace("'""\\'");
            Msg 
= Msg.Replace("\n""\\n");
            re 
= re + "<script language='JavaScript' type='text/javascript'>";
            re 
= re + "alert('" + Msg + "');";
            
if (type == 0)
            
{
            }

            
else if (type == 1)
            
{
                re 
= re + "parent.location.href='" + Url + "';";
            }

            
else if (type == 2)
            
{
                re 
= re + "parent.treeframe.location='" + Url + "';";
                re 
= re + "window.history.back();";
            }

            
else if (type == 3)
            
{
                
//System.Web.HttpContext.Current.Response.Write("parent.leftFrame.location='"+Url+"';");
                re = re + "window.close();";
            }

            
else
            
{
                re 
= re + "parent.basefrm.location='" + Url + "';";
            }

            re 
= re + "</script>";
            
return re;
        }



        
//Confirm(1)
        public static string Confirm(string Msg, string Url0, string Url1)
        
{
            
string re = "";
            Msg 
= Msg.Replace("'""\\'");
            Msg 
= Msg.Replace("\n""\\n");
            re 
= re + "<script language='JavaScript' type='text/javascript'>";
            re 
= re + "if(confirm('" + Msg + "')){parent.basefrm.location='" + Url0 + "';}";
            re 
= re + "else{parent.basefrm.location='" + Url1 + "';}";
            re 
= re + "</script>";
            
return re;
        }

        
//Confirm(2)top
        public static string Confirm(string Msg, string Url0, string Url1, int type)
        
{
            
string re = "";
            Msg 
= Msg.Replace("'""\\'");
            Msg 
= Msg.Replace("\n""\\n");
            re 
= re + "<script language='JavaScript' type='text/javascript'>";
            
if (type == 1)
            
{
                re 
= re + "if(confirm('" + Msg + "')){top.location='" + Url0 + "';}";
                re 
= re + "else{parent.basefrm.location='" + Url1 + "';}";
            }

            re 
= re + "</script>";
            
return re;
        }

}

}
posted on 2007-09-23 18:42  罗明超  阅读(211)  评论(0)    收藏  举报