zoukankan      html  css  js  c++  java
  • PhoneGap 开发笔记

    1 调死调活都调不出来的情况下,可以考虑更换下phoneGap 版本,尽量用比较新的版本.

    2 form submit 会返回

    3 jquery mobile 的4个初始化事件
    第一个触发的事件是mobileinit,其次pagebeforecreate,再次pagecreate,最后pageinit
    Mobileinit Document还没有加入到DOM树中,mobileinit事件中对html的操作时徒劳的
    Pagebeforecreate 页面的DOM加载后,DOM初始化之前 触发的事件。
    Pagecreate 这个事件,在HTML已经在DOM中建立完成,初始化也完成。
    Pageinit 展开完成后触发的事件。是jQuery mobile中的$(document).ready()


    4 在线引用
    <head>
    <meta charset="utf-8" />
    <title>Intro to jQuery Mobile</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
    <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
    </head>

    5 页脚导航栏
    <div data-role="footer" class="ui-bar">
    <div data-role="controlgroup" data-type="horizontal">
    <a href="index.html" data-role="button">Today</a>
    <a href="index.html" data-role="button">Tomorrow</a>
    <a href="index.html" data-role="button">Week</a>
    <a href="index.html" data-role="button">No date</a>
    </div>
    </div>

    6 页面过渡两种方式
    链接 <a href="index.html" data-transition="pop" data-back="true">
    编程 $.mobile.changePage("pendingtasks.html", "slideup");

    7 全屏样式:data-fullscreen="true"
    自定义导航菜单: class="ui-bar ui-bar-b"

    8 图标位置:data-iconpos="top | bottom | left | right"
    按钮并列:data-inline="true"

    9 折叠
    <div data-role="collapsible-set">
    <div data-role="collapsible" data-collapsed="false">
    <h3>Section 1</h3>
    <p>I'm the collapsible set content for section B.</p>
    </div>
    <div data-role="collapsible">
    <h3>Section 2</h3>
    <p>I'm the collapsible set content for section B.</p>
    </div>
    </div>

    10 <strong></strong> html 标签 强调 粗体

    11 只读列表:没有<a>链接 列表右边 没有箭头

    12 rel="external" 如果跳转到另外一个页面的时候需要加此属性 )当连接到一个多页面文档时

    13 更新列表:$('#mylist').listview('refresh');

    14 隐藏标签
    <div data-role="fieldcontain" class="ui-hide-label">
    <label for="username">Username:</label>
    <input type="text" name="username" id="username" value="" placeholder="Username"/>
    </div>

    15 开关 data-role="slider"
    <select name="slider" id="flip-c" data-role="slider" data-theme="a">
    <option value="no">No</option>
    <option value="yes">Yes</option>
    </select>

    16 class="ui-li-aside" 里面的内容靠右

    17 data-inset="true"不占据整个屏幕,在一个圆角区域内

    18 <span class="ui-li-count">1 day</span> 数字区

    19 拆分列表样式 <ul data-role="listview" data-split-icon="star" data-split-theme="d">

    20 打开dailog
    <a href="confirmtion.html" data-rel="dialog">Open Dialog</a>

    21 返回按钮
    <div data-role="page" data-auto-back-btn="true" data-back-btn-text="返回" data-back-btn-theme="e">
    <a data-role="button" data-add-back-btn='true' data-rel="back" >返回</a>

    22 返回链接
    <a href="#mail" data-rel="back" data-role="button">返回</a> href 不支持JS的,作为备用

    23 Navigator 对象返回浏览器的相关信息
    userAgent属性,返回包含浏览器版本等信息的字符串,cookieEnabled使用它可以判断用户浏览器是否开启cookie

    24 encodeURI() js函数可把字符串作为 URI 进行编码。

    25 ajax 跨域 要用jsonp 传统的ajax的方式直接去获取值json值,是行不通的!原因是ajax不支持跨域访问获取数据,想获取服务端的数据,需要用到jsonp协议!

    26 phonegap 跨域
    $( document ).bind( "mobileinit", function() {
    $.mobile.allowCrossDomainPages = true;
    });

    27 设置安卓系统加载URL时间 super.setIntegerProperty("loadUrlTimeoutValue", 60000);

    28 setInterval 在执行完一次代码之后,经过了那个固定的时间间隔,它还会自动重复执行代码 , setTimeout只执行一次那段代码

    29 javascript函数querySelector 用于获得dom节点 很像jquery 选择器

    30 white-space : nowrap :  强制在同一行内显示所有文本,直到文本结束或者遭遇 br 对象。

    31 只有一个html页面其它都是潜入第一个载入的页面的,所以所有的css和js文件都可以放到第一个加载的HtmL文件中,页面间的切换都是新的html页面片段插入到第一个HtmL页面的.

    32 关于checkbox取值问题 $(.checkbox)[0].checked

    33 CSS3 媒体查询

    34 JS match('') 指定字符串内检索指定的值
    var deviceAgent = navigator.userAgent.toLowerCase();
    var agentID = deviceAgent.match(/(iphone|ipod|ipad|android)/);
    if(agentID.indexOf("iphone")>=0){
    alert("iphone");
    }

    35 js apply call 方法
    Function.apply(obj,args)方法能接收两个参数 obj:这个对象将代替Function类里this对象 Person.apply(this,arguments); 学生类有了Person类的方法
    args 是个数组,可以将数组自动转换 一般在目标函数只需要n个参数列表 可应用此

    36 Ajax技术:由于浏览器的安全模型,在用Ajax和后台通信时候会遇到跨域安全限制的问题,所以如果想要安全的进行跨域通信,服务端采用Jsonp协议通讯,js通过get传递参数给后台,后台生成Json字符串,然后js通过
    $.getJSON()获取返回值,且无跨域问题。


    37 Matcher matcher = Pattern.compile("".+"").matcher(new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("js/common.js"))).readLine());

  • 相关阅读:
    淘宝网六个质量属性场景
    架构漫谈阅读笔记2
    poj 3304
    poj 2318
    bzoj 4008
    任意模数NTT
    CF623E
    CF712E
    bzoj 1925
    bzoj 4710
  • 原文地址:https://www.cnblogs.com/brucetie/p/3459662.html
Copyright © 2011-2022 走看看