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/
相關文章
相關標籤/搜索