function UrlEncode(str)//url编码
{
var i,temp,p,q;
var result="";
for(i=0;i<str.length;i++)
{  
temp = str.charCodeAt(i);
   if(temp>=0x4e00)
{   
   execScript("ascCode=hex(asc(\""+str.charAt(i)+"\"))", "vbscript");
    result+=ascCode.replace(/(.{ 2 })/g, "%$1");
   }else{   
   result+=escape(str.charAt(i));  
}
}
return result;
}

function UrlDecode( str )
{
var i,temp;
var result = "";

for( i=0; i<str.length; i++ )
{
if( str.charAt(i) == "%" )
{   
   if( str.charAt(++i) == "u" )
   {    
    temp = str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i);
    result += unescape("%" + temp);
   }
   else
   {
    temp = str.charAt(i++) + str.charAt(i);
    if( eval("0x"+temp) <= 160 )
    {    
     result += unescape( "%" + temp );
    }
    else
    {
     temp += str.charAt(++i) + str.charAt(++i) + str.charAt(++i);
     result += Decode_unit("%" + temp);   
    }   
   }  
}
else
{
   result += str.charAt(i);
}
}

return result;
}

兼容火狐,ie8的 js urlencode和urldecode的更多相关文章

  1. js兼容火狐显示上传图片预览效果

    js兼容火狐显示上传图片预览效果[谷歌也适用] <!doctype html> <html> <head> <meta content="text/ ...

  2. 兼容火狐,Chrome,IE6,IE7,IE8的HTML换行写法

    本文链接:https://java-er.com/blog/html-break-line-firefox-chrome/ 兼容火狐,Chrome,IE6,IE7,IE8的HTML换行写法1.任意数据 ...

  3. js下载base64格式的图片(兼容火狐)

    //下载图片 download() { let imgData = 'data:image/png;base64,iVBORw0KGgoAAAANSUh........'; this.download ...

  4. ie不兼容的几个js问题及解决办法

    1.table问题 在动态新增tr或者td时,createElement()一般用appendChild();都不生效,解决办法是用新增tbody,如 var table=document.creat ...

  5. 一行代码解决各种IE兼容问题IE8,IE9,IE10

    一:一.指定文件兼容性模式(Xee:因为我已经放弃IE6,7了,所以以后设计的网页最低支持IE8;) 要为你的网页指定文件模式,需要在你的网页中使用meta元素放入X-UA-Compatible ht ...

  6. 实现关闭窗口IE不提示兼容火狐

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  7. 向上下左右不间断无缝滚动图片的效果(兼容火狐和IE)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. 开源自己写的一个拖拽库,兼容到IE8+

    github地址:https://github.com/qiangzi7723/draggable 目前这个库的兼容做到了兼容IE8,所以如果需要兼容IE8的朋友不妨试试.库里面写了很多的注释,对于想 ...

  9. jQuery兼容浏览器IE8方法

    在维护公司网站的时候,发现在IE8下jquery会报对象不支持此属性或方法.缺少对象的错误:  在其他浏览器就可以正常运行,当前使用的jquery版本是3.1.1,查资料发现jquery从2.0开始不 ...

随机推荐

  1. linux下通过iptables只允许指定ip地址访问指定端口的设置方法

    这篇文章主要介绍了linux下通过iptables只允许指定ip地址访问指定端口的设置方法,需要的朋友可以参考下. 首先,清除所有预设置 iptables -F#清除预设表filter中的所有规则链的 ...

  2. [Android Pro] Android中IntentService的原理及使用

    转载自:http://blog.csdn.net/ryantang03/article/details/8146154 在Android开发中,我 们或许会碰到这么一种业务需求,一项任务分成几个子任务 ...

  3. Java多媒体编程应用

    1. 声音文件的播放 1.1 在Applet中播放声音 在Applet中,可以使用AudioClip来播放声音,它非常简单,只有三个方法:play().loop()和stop(). 例1.1 利用Au ...

  4. [20] 鼓状物(Drum)图形的生成算法

    顶点数据的生成 bool YfBuildDrumVertices ( Yreal radius, Yreal assistRadius, Yuint slices, Yuint stacks, YeO ...

  5. java之 22天 GUI 图形界面编程(一)

    转自:http://takeme.iteye.com/blog/1876850 GUI(图形用户界面) import java.awt.Button; import java.awt.FlowLayo ...

  6. 第十一章 springboot + mongodb(简单查询)

    1.mongodb在mac上的安装 下载mongodb,https://www.mongodb.org/ 解压缩到一个指定文件夹,如:/Users/enniu1/Desktop/zjg/mongodb ...

  7. mysql必知必会(一、数据库基础知识)

    基础概念 1.数据库(database):是一个以某种有组织的方式存储的数据集合.(保存有组织的数据的容器) 2.表(table):是一种结构化的文件,可用来存储某种特定类型的数据.(表名在同个数据库 ...

  8. homogeneous clip space and NDC

    CVV  canonical view volume HCS homogeneous clip space NDC nomolized device coordinates pipeline 的 ge ...

  9. DIV-CSS布局中position属性详解

    本文向大家描述一下DIV CSS布局中的position属性的用法,position属性主要有四种属性值,任何元素的默认position的属性值均是static,静态.这节课主要讲讲relative( ...

  10. E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    sudo rm /var/lib/dpkg/locksudo dpkg --configure -a