<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery.mobile.activePage demo</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<style>
#myResult {
border: 1px solid;
border-color: #108040;
padding: 10px;
}
</style>
</head>
<body> <div data-role="page" id="page1">
<div data-role="header">
<h1>Page 1</h1>
</div>
<div data-role="content">
<a href="#page2" data-role="button" data-inline="true">Go to Page 2</a>
<input type="button" value="Which Page is this?" class="myButton" data-inline="true"/> <br>
<div class="myResult">The result will be displayed here</div>
</div>
</div> <div data-role="page" id="page2">
<div data-role="header">
<h1>Page 2</h1>
</div>
<div data-role="content">
<a href="#page1" data-role="button" data-inline="true">Go to Page 1</a>
<input type="button" value="Which Page is this?" class="myButton" data-inline="true"/> <br>
<div class="myResult">The result will be displayed here</div>
</div>
</div> <script>
$(function() {
$( ".myButton" ).on( "click", function() {
var whichPageId = $.mobile.activePage.attr( "id" );
$( ".myResult" ).html( "This is " + whichPageId );
});
});
</script> </body>
</html>

jQuery.mobile.activePage获取当点活动的page的更多相关文章

  1. jQuery Mobile + HTML5 获取地理位置信息

      这个代码也非常简单,核心是HTML5中GeoLocation API,函数原型定义如下: void getCurrentPosition(in PositionCallback successCa ...

  2. jQuery Mobile Api

        jQuery Mobile提供了使用Javascript与框架(html5)通信以及进行内容管理的API.下面介绍具体事件. 文档事件     mobileinit事件会在jQuery Mob ...

  3. jQuery Mobile学习日记(二)

    首先依HTML5方式加载,DOCTYPE表示格式为HTML5:主要适用于iPhone.Android等,viewport表示适用于移动终端的适中显示,initial-scale缩放比例在1.0~1.3 ...

  4. 学习jquery mobile

    学习jquery mobile的时间不是很长,在学习的过程当中也遇到了很多令人抓狂的问题,在网上搜索问题答案的时候发现,现在关于jquery mobile的文章还不是很多,所以,我也是一边学习,一边摸 ...

  5. [转]Passing data between pages in JQuery Mobile mobile.changePage

    本文转自:http://ramkulkarni.com/blog/passing-data-between-pages-in-jquery-mobile/ I am working on a JQue ...

  6. JQuery Mobile的页面

    1.JQuery Mobile的页面结构如下图: page:是在浏览器中显示的页面 header:创建页面上方的工具栏(常用于标题和搜索按钮) content:定义了页面的内容,比如文本, 图片,表单 ...

  7. 如何修改Jquery Mobile 设置默认选项

    以下的默认配置可以通过$.mobile对象重新配置自定义命名空间s (字符, 默认: ""): 在jQuery Mobile中,甚至可以自定义象HTML5中的data-attrib ...

  8. jQuery.mobile.changePage的参数

    选项 类型:对象 属性: allowSamePageTransition(默认值:假的) 类型:布尔 默认情况下,changePage()忽略请求更改为当前活动页面.将此选项设置为true,则允许该请 ...

  9. jQuery Mobile中jQuery.mobile.changePage方法使用详解

    jQuery.mobile.changePage方法用的还是很多的.作为一个老手,有必要对jQuery mobile中实用方法做一些总结.系列文章请看jQuery Mobile专栏.jquery.mo ...

随机推荐

  1. 了解Json

    Json(JavaScript Object Notation) 是一种轻量级的数据交换格式,它是基于JavaScript的一个子集. 数据格式简单, 易于读写, 占用带宽小. {'age':'12' ...

  2. LCIS HDOJ 4512 吉哥系列故事——完美队形I

    题目传送门 题意:中文题面 分析:LCIS应用:设置b[]为a[]的反转,然后LCIS,若相等的是自己本身,则+1, 否则+2 代码: #include <cstdio> #include ...

  3. 水题 ZOJ 3876 May Day Holiday

    题目传送门 /* 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了: */ #include <cstdio> #include <iostream> ...

  4. 不容易系列之(4)——考新郎[HDU2049]

    不容易系列之(4)——考新郎 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  5. BZOJ4120 : [Baltic2015]Editor

    活跃区的操作序列的优先级单调不上升,所以每次undo的一定是一段区间. 以优先级为权值建立可持久化权值线段树,维护优先级在某区间内的最靠后的位置. #include<cstdio> con ...

  6. JSON转换为数组 但读取JSON的顺序目前没法保证

    var json = {a : 1, b : 2, c: 3}; var jsonArr = []; for (i in json){ var wrap = []; wrap[0] = i; wrap ...

  7. NOI2011阿狸的打字机(fail树+DFS序)

    Description 阿狸喜欢收藏各种稀奇古怪的东西,最近他淘到一台老式的打字机.打字机上只有28个按键,分别印有26个小写英文字母和'B'.'P'两个字母. 经阿狸研究发现,这个打字机是这样工作的 ...

  8. TV测试中的按键长按操作模拟

    从UiAutomator在TV测试中的局限性说起: 智能TV的操作和手机的操作有很大不同,一般智能TV的操作为遥控器按键操作,来向TV OS发送  KeyCode,以完成指定操作. UiAutomat ...

  9. 使用STL库sort函数对vector进行排序

    使用STL库sort函数对vector进行排序,vector的内容为对象的指针,而不是对象. 代码如下 #include <stdio.h> #include <vector> ...

  10. hdu1028 Ignatius and the Princess III

    这是道典型的母函数的题目,可以看看我的母函数这一标签上的另一道例题,里面对母函数做了较为详细的总结.这题仅贴上代码: #include"iostream" using namesp ...