asp.net url传参中使用javascript过滤中文乱码

以下代码我已经测试过了,ie firefox都通过了

Author:mysshfunction ShowWin(url,w,h)
           {
            var newurl,arrurl;
            if(typeof(url) == "undefined" || url == "")
            {
                return ;
            }
            else
            {
                if(url.indexOf("?") == -1)
                {
                    newurl = url;
                }
                else
                {
                    newurl = url.substring(0,url.indexOf("?")+1);
                    arrurl = url.substring(url.indexOf("?")+1).split("&");
                    for(var i =0;i<arrurl.length;i++)
                    {
                        newurl += arrurl[i].split("=")[0] + "=" + escape(arrurl[i].split("=")[1]) + "&";
                    }
                    newurl = newurl.substring(0,newurl.length-1);
                }
            }
                window.showModalDialog(newurl,null,"status:no;dialogWidth:"+w+"px;dialogHeight:" + h + "px;dialogHide:true;help:no;scroll:no;");
           
           }        

 

posted on 2009-04-15 16:21  ToKens  阅读(577)  评论(0编辑  收藏  举报