您的位置: bluesailor散记——
« sql批量添加数据类中Response的使用 »

利用javascript的escape实现asp页面,实现asp.net中的server.urlencode.

分类: 常见问题 发布: admins 浏览: 日期: 2008年10月10日


<script language="JavaScript">
function winopen(url,width,height)
{
     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);
         }
     }
     if(typeof(width) != "number" || typeof(height) != "number")
     {
         window.open(newurl);
     }
     else
     {
         window.open(newurl,"","width=" + width + ",height=" + height);
     }
}
</script>
<a href="#" onclick="winopen('/test.aspx?title=网页');">Links</a>

相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-Blog 1.8 Spirit Build 80722

Copyright Lunji.com Some Rights Reserved.