亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery實(shí)現(xiàn)瀏覽器之間跳轉(zhuǎn)并傳遞參數(shù)功能【支持中文字符】

 更新時(shí)間:2018年03月28日 09:54:05   作者:郭浩326  
這篇文章主要介紹了jQuery實(shí)現(xiàn)瀏覽器之間跳轉(zhuǎn)并傳遞參數(shù)功能,具有支持中文字符傳輸?shù)墓δ?涉及jQuery編碼轉(zhuǎn)換、事件響應(yīng)、頁(yè)面跳轉(zhuǎn)等相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)瀏覽器之間跳轉(zhuǎn)并傳遞參數(shù)功能。分享給大家供大家參考,具體如下:

one.html

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="https://cdn.bootcss.com/jquery/2.2.2/jquery.slim.js"></script>
</head>
<body>
<input type="text" class="keyword"/>
<button id="searchBtn">點(diǎn)擊</button>
<script type="text/javascript">
  $("#searchBtn").click(function() {
    var searchText = jQuery.trim($(".keyword").val());
    var searchUrl = encodeURI("two.html?searchText=" + searchText); //使用encodeURI編碼
    location.href = searchUrl;
  })
</script>
</body>
</html>

two.html

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="https://cdn.bootcss.com/jquery/2.2.2/jquery.slim.js"></script>
</head>
<body>
<input type="text" class="keyword1"/>
<script type="text/javascript">
  //獲取 上一個(gè)搜索頁(yè)面?zhèn)鱽?lái)的參數(shù) 
  var searchUrl = window.location.href;
  var searchData = searchUrl.split("="); //截取 url中的“=”,獲得“=”后面的參數(shù)
  var searchText = decodeURI(searchData[1]); //decodeURI解碼
  $(".keyword1").val(searchText);
</script>
</body>
</html>

運(yùn)行結(jié)果:

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《jQuery常見(jiàn)事件用法與技巧總結(jié)》、《jQuery form操作技巧匯總》、《jQuery操作json數(shù)據(jù)技巧匯總》、《jQuery常用插件及用法總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery表格(table)操作技巧匯總》及《jquery選擇器用法總結(jié)

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

相關(guān)文章

最新評(píng)論