成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導(dǎo)航首頁(yè) ? 技術(shù)教程 ? jQuery mobile轉(zhuǎn)換url地址及獲取url中目錄部分的方法
全站頭部文字 我要出現(xiàn)在這里
jQuery mobile轉(zhuǎn)換url地址及獲取url中目錄部分的方法 650 2024-03-18   

path.makeUrlAbsolute() 把相對(duì)URL轉(zhuǎn)化為絕對(duì)URL

jQuery.mobile.path.makeUrlAbsolute( relUrl, absUrl )

把相對(duì)URL轉(zhuǎn)化為絕對(duì)URL的方法。這個(gè)函數(shù)返回一個(gè)字符串,絕對(duì)URL。

relUrl:相對(duì)網(wǎng)址。類(lèi)型:字符串。

absUrl:絕對(duì)網(wǎng)址。類(lèi)型:字符串。

<!doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>jQuery.mobile.path.makeUrlAbsolute demo</title>
 <link rel="stylesheet" >
 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 < The script below can be omitted -->
 <script src="http://www.gimoo.net/resources/turnOffPushState.js"></script>
 <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
 <style>
 #myResult{
  border: 1px solid;
  border-color: #108040;
  padding: 10px;
  }
 </style>
</head>
<body>
 
<div data-role="page">
 
 <div data-role="content">
  <p>The absoulte URL used is http://foo.com/a/b/c/test.html</p>
  <input type="button" value="file.html" id="button1" class="myButton" data-inline="true">
  <input type="button" value="../../foo/file.html" id="button2" class="myButton" data-inline="true">
  <input type="button" value="http://foo.com/bar/file.html" id="button3" class="myButton" data-inline="true">
  <input type="button" value="?a=1&b=2" id="button4" class="myButton" data-inline="true">
  <input type="button" value="#bar" id="button5" class="myButton" data-inline="true">
  <div id="myResult">The result will be displayed here</div>
 </div>
</div>
<script>
$(document).ready(function() { 
  $( ".myButton" ).on( "click", function() { 
   var absUrl = $.mobile.path.makeUrlAbsolute( $( this ).attr( "value" ), "http://foo.com/a/b/c/test.html" ); 
  $( "#myResult" ).html( absUrl );
 }) 
});
</script>
 
</body>
</html>

path.get() 確定URL中的目錄部分

jQuery.mobile.path.get( url )

url:只有一個(gè)參數(shù)。類(lèi)型:字符串。

確定URL中的目錄部分的實(shí)用方法。如果URL沒(méi)有斜線,URL的一部分被認(rèn)為是一個(gè)文件。這個(gè)函數(shù)返回一個(gè)給定的URL目錄部分。

<!doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>jQuery.mobile.path.get demo</title>
 <link rel="stylesheet" >
 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 < The script below can be omitted -->
 <script src="http://www.gimoo.net/resources/turnOffPushState.js"></script>
 <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
 <style>
 #myResult{
  border: 1px solid;
  border-color: #108040;
  padding: 10px;
  }
 </style>
</head>
<body>
 
<div data-role="page"> 
 <div data-role="content">
  <input type="button" value="http://foo.com/a/file.html" id="button1" class="myButton" data-inline="true" />
  <input type="button" value="http://foo.com/a/" id="button2" class="myButton" data-inline="true" />
  <input type="button" value="http://foo.com/a" id="button3" class="myButton" data-inline="true" />
  <input type="button" value="http://foo.com/a/file.html" id="button4" class="myButton" data-inline="true" />
  <input type="button" value="/a/file.html" id="button5" class="myButton" data-inline="true" />
  <input type="button" value="file.html" id="button6" class="myButton" data-inline="true" />
  <input type="button" value="/file.html" id="button7" class="myButton" data-inline="true" />
  <input type="button" value="?a=1&b=2" id="button8" class="myButton" data-inline="true" />
  <input type="button" value="#foo" id="button9" class="myButton" data-inline="true" />
  <div id="myResult">The result will be displayed here</div>
 </div>
</div>
<script>
$(document).ready(function() { 
  $( ".myButton" ).on( "click", function() { 
   var dirName = $.mobile.path.get( $( this ).attr( "value" ) ); 
  $( "#myResult" ).html( String( dirName ) );
 }) 
});
</script>
 
</body>
</html>


主站蜘蛛池模板: 王雪华| 色域在线| 素人av在线| 王风| 大决战免费观看| 孔丽娜个人资料简介| 家庭理论电影| 91精品在线视频播放| 生产时直拍宫口| 彭丹露点| 巴霍巴利王2国语版在线观看免费 惊弦电视剧完整版免费观看高清 梦的衣裳 | cctv16体育节目表今天目表| 家庭理论电影| 男同性恋者| 斗音| 吴亿晨| 职业目标评估| 成人免费黄色电影| 画江湖之不良人第一季动漫免费观看| 潘霜霜惊艳写真照| 漂亮孕妇突然肚子疼视频| 流行歌简谱| the girl next door| 新版731部队电影免费| 潘馨| 电影宝贝| 视力图| 健康中国科普先行直播回放| 掀开jk扒开内裤打屁股作文| 老司机免费福利在线观看| 相识在线观看| 手机演员表| 对称度| 微信头像2024年最新版图片男| 影子人| 小学毕业老师解散班级群寄语| 欧美17p| 诈欺游戏电影| 辩论赛作文| 奥赛健美| 情动电影|

!!!站長(zhǎng)長(zhǎng)期在線接!!!

網(wǎng)站、小程序:定制開(kāi)發(fā)/二次開(kāi)發(fā)/仿制開(kāi)發(fā)等

各種疑難雜癥解決/定制接口/定制采集等

站長(zhǎng)微信:lxwl520520

站長(zhǎng)QQ:1737366103