decodeURIComponent 测试

  1. var test1="http://www.wljcz.com/My first/";  
  2. var nn=encodeURI(test1);  
  3. var now=decodeURI(test1);  
  4. document.write(nn+ "<br />");  
  5. document.write(now);  
  6.   
  7. var test1="http://www.wljcz.com/My first/";  
  8. var bb=encodeURIComponent(test1);  
  9. var nnow=decodeURIComponent(bb);  
  10. document.write(bb+ "<br />");  
  11. document.write(nnow);  
  12. 其运行结果为:
    http://www.wljcz.com/My%20first/
    http://www.wljcz.com/My first/
    http%3A%2F%2Fwww.wljcz.com%2FMy%20first%2F
    http://www.wljcz.com/My first/
 
 
 
posted @ 2019-01-27 23:07  jason_xiao  阅读(134)  评论(0编辑  收藏  举报