欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript使用encodeURI()和decodeURI()獲取字符串值的方法

 更新時(shí)間:2015年08月04日 16:12:40   作者:皮蛋  
這篇文章主要介紹了JavaScript使用encodeURI()和decodeURI()獲取字符串值的方法,實(shí)例分析了encodeURI()和decodeURI()函數(shù)解析字符串的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了JavaScript使用encodeURI()和decodeURI()獲取字符串值的方法。分享給大家供大家參考。具體如下:

JavaScript使用encodeURI()和decodeURI()獲取字符串值,不能就是地址欄顯示的字串,以前經(jīng)常在網(wǎng)上見(jiàn)到有人問(wèn)此問(wèn)題,無(wú)意在網(wǎng)上發(fā)現(xiàn),不知是不是您想要的,先看看效果吧。

先來(lái)看看運(yùn)行效果:

具體代碼如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>使用系統(tǒng)函數(shù)</title>
<script language="JavaScript">
<!--
 function showMsg()
 {
  var strURL= url.value;
  var encodeStr = encodeURI(strURL);
  var temp = encodeStr+"\n";
  temp += decodeURI(encodeStr);
  alert(temp);
 }
-->
</script> 
</head>
<body>
<div>
  請(qǐng)輸入一個(gè)URL:<input name="url" type="text" id="url" value="/search.php?keyword=搜索關(guān)鍵字" size="60" />
  <input type="submit" name="button" id="button" value="我要提交" onclick="showMsg();" /></div>
 <dIV class="vc" style="margin: 20px auto" >
<h2>使用encodeURI()和decodeURI()函數(shù):</h2>
</dIV>
</body>
</html>

希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論