JS PHP 乱入

http://www.css88.com/tool/hack/ (兼容浏览器的HANK)
http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html   微信分享
http://www.oschina.net/p/weui  微信
https://bce.baidu.com/doc/MCT/Web-SDK.html#.E0.A3.37.92.0E.B2.72.7C.BF.01.70.34.6C.3F.8B.80  视频属性
http://www.runoob.com/  node.js学习资料
 <meta name="renderer" content="webkit|ie-comp|ie-stand">  
 
// if (!Function.prototype.bind) {
    //     Function.prototype.bind = function (o/*, args*/) {
    //         if (typeof this !== "function") {
    //             // closest thing possible to the ECMAScript 5 internal IsCallable function 
    //             throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); 
    //         }
             
    //         var self=this, boundArgs=arguments;
    //         return function(){
    //             var args=[],i;
    //             for(i=1; i<boundArgs.length; i++) args.push(boundArgs[i]);
    //             for(i=0; i<arguments.length; i++) args.push(arguments[i]);
             
    //             return self.apply(o, args);
    //         };
    //     }; 
    // }
    // if (typeof Array.prototype.filter != "function") {
    //   Array.prototype.filter = function (fn, context) {
    //     var arr = [];
    //     if (typeof fn === "function") {
    //        for (var k = 0, length = this.length; k < length; k++) {
    //           fn.call(context, this[k], k, this) && arr.push(this[k]);
    //        }
    //     }
    //     return arr;
    //   };
    // }
    // if(!document.getElementsByClassName){
    //     document.getElementsByClassName = function(){
    //       var tTagName ="*";
    //       if(arguments.length > 1){
    //         tTagName = arguments[1];
    //       }
    //       if(arguments.length > 2){
    //         var pObj = arguments[2];
    //       }
    //       else{
    //         var pObj = document;
    //       }
    //       var objArr = pObj.getElementsByTagName(tTagName);
    //       var tRObj = new Array();
         
    //       for(var i=0; i<objArr.length; i++){
    //           if(objArr[i].className == arguments[0]){
    //              tRObj.push(objArr[i]);
    //           }
    //       }
    //       return tRObj;
    //     }
    // }




CSS3 动画的暂停和启动


 animation-play-state: running;
 animation-play-state: paused;






if (!Function.prototype.bind) {
        Function.prototype.bind = function (o/*, args*/) {
            if (typeof this !== "function") {
                // closest thing possible to the ECMAScript 5 internal IsCallable function 
                throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); 
            }
             
            var self=this, boundArgs=arguments;
            return function(){
                var args=[],i;
                for(i=1; i<boundArgs.length; i++) args.push(boundArgs[i]);
                for(i=0; i<arguments.length; i++) args.push(arguments[i]);
             
                return self.apply(o, args);
            };
        }; 
    }
<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 -->
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
    <!-- 声明文档使用的字符编码 -->
    <meta charset='utf-8'>
    <!-- 优先使用 IE 最新版本和 Chrome -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <!-- 页面描述 -->
    <meta name="description" content="不超过150个字符"/>
    <!-- 页面关键词 -->
    <meta name="keywords" content=""/>
    <!-- 网页作者 -->
    <meta name="author" content="name, email@gmail.com"/>
    <!-- 搜索引擎抓取 -->
    <meta name="robots" content="index,follow"/>
    <!-- 为移动设备添加 viewport -->
    <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
    <!-- `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz -->
 
    <!-- iOS 设备 begin -->
    <meta name="apple-mobile-web-app-title" content="标题">
    <!-- 添加到主屏后的标题(iOS 6 新增) -->
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <!-- 是否启用 WebApp 全屏模式,删除苹果默认的工具栏和菜单栏 -->
 
    <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
    <!-- 添加智能 App 广告条 Smart App Banner(iOS 6+ Safari) -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <!-- 设置苹果工具栏颜色 -->
    <meta name="format-detection" content="telphone=no, email=no"/>
    <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
    <!-- 启用360浏览器的极速模式(webkit) -->
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 不让百度转码 -->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 -->
    <meta name="HandheldFriendly" content="true">
    <!-- 微软的老式浏览器 -->
    <meta name="MobileOptimized" content="320">
    <!-- uc强制竖屏 -->
    <meta name="screen-orientation" content="portrait">
    <!-- QQ强制竖屏 -->
    <meta name="x5-orientation" content="portrait">
    <!-- UC强制全屏 -->
    <meta name="full-screen" content="yes">
    <!-- QQ强制全屏 -->
    <meta name="x5-fullscreen" content="true">
    <!-- UC应用模式 -->
    <meta name="browsermode" content="application">
    <!-- QQ应用模式 -->
    <meta name="x5-page-mode" content="app">
    <!-- windows phone 点击无高光 -->
    <meta name="msapplication-tap-highlight" content="no">
    <!-- iOS 图标 begin -->
    <link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-57x57-precomposed.png"/>
    <!-- iPhone 和 iTouch,默认 57x57 像素,必须有 -->
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png"/>
    <!-- Retina iPhone 和 Retina iTouch,114x114 像素,可以没有,但推荐有 -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144x144-precomposed.png"/>
    <!-- Retina iPad,144x144 像素,可以没有,但推荐有 -->
    <!-- iOS 图标 end -->
 
    <!-- iOS 启动画面 begin -->
    <link rel="apple-touch-startup-image" sizes="768x1004" href="/splash-screen-768x1004.png"/>
    <!-- iPad 竖屏 768 x 1004(标准分辨率) -->
    <link rel="apple-touch-startup-image" sizes="1536x2008" href="/splash-screen-1536x2008.png"/>
    <!-- iPad 竖屏 1536x2008(Retina) -->
    <link rel="apple-touch-startup-image" sizes="1024x748" href="/Default-Portrait-1024x748.png"/>
    <!-- iPad 横屏 1024x748(标准分辨率) -->
    <link rel="apple-touch-startup-image" sizes="2048x1496" href="/splash-screen-2048x1496.png"/>
    <!-- iPad 横屏 2048x1496(Retina) -->
 
    <link rel="apple-touch-startup-image" href="/splash-screen-320x480.png"/>
    <!-- iPhone/iPod Touch 竖屏 320x480 (标准分辨率) -->
    <link rel="apple-touch-startup-image" sizes="640x960" href="/splash-screen-640x960.png"/>
    <!-- iPhone/iPod Touch 竖屏 640x960 (Retina) -->
    <link rel="apple-touch-startup-image" sizes="640x1136" href="/splash-screen-640x1136.png"/>
    <!-- iPhone 5/iPod Touch 5 竖屏 640x1136 (Retina) -->
    <!-- iOS 启动画面 end -->
 
    <!-- iOS 设备 end -->
    <meta name="msapplication-TileColor" content="#000"/>
    <!-- Windows 8 磁贴颜色 -->
    <meta name="msapplication-TileImage" content="icon.png"/>
    <!-- Windows 8 磁贴图标 -->
 
    <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml"/>
    <!-- 添加 RSS 订阅 -->
    <link rel="shortcut icon" type="image/ico" href="/favicon.ico"/>
    <!-- 添加 favicon icon -->


    <!-- sns 社交标签 begin -->
    <!-- 参考微博API -->
    <meta property="og:type" content="类型" />
    <meta property="og:url" content="URL地址" />
    <meta property="og:title" content="标题" />
    <meta property="og:image" content="图片" />
    <meta property="og:description" content="描述" />
    <!-- sns 社交标签 end -->
 
    <title>标题</title>
</head>




插件编写模式
var $ = require('common:jquery');


function serverError(opt) {
this.options = $.extend({
dom: null
}, opt || {});


this.init();
}


serverError.prototype = {
init: function() {
this.errID = this.options.dom + "serverError";
var html = '<span id=' +  this.errID + ' class="ui-formvalid-field ui-formvalid-field-error server-error" data-formvalid-target="sMobile" style="position: absolute;top: -25px;left: 0px;font-size: 12px;display:none;">请输入正确的手机号</span>'
$('#' + this.options.dom).css("position", "relative").append(html);
},


show: function(msg) {
$('#' + this.errID).text(msg).show();
},


hide: function() {
$('#' + this.errID).hide();
}
}


return serverError;






1.产生随机数
  
  Math.floor(Math.random()*11)   (产生0-10之间的随机数)


// 横屏监听
var updateOrientation = function(){
    if(window.orientation=='-90' || window.orientation=='90'){
        $('.landscape-wrap').removeClass('hide');
        console.log('为了更好的体验,请将手机/平板竖过来!');
    }else{
        $('.landscape-wrap').addClass('hide');
        console.log('竖屏状态');
    }
};
window.onorientationchange = updateOrientation;


2.显示显示器的宽高


  var w=window.innerWidth
   || document.documentElement.clientWidth
   || document.body.clientWidth;


  var h=window.innerHeight
   || document.documentElement.clientHeight
   || document.body.clientHeight;
  
  screen.availWidth - 可用的屏幕宽度
  screen.availHeight - 可用的屏幕高度


3.窗口调用方法


  window.open() - 打开新窗口
  window.close() - 关闭当前窗口
  window.moveTo() - 移动当前窗口
  window.resizeTo() - 调整当前窗口的尺寸


4.窗口返回
  location.hostname 返回 web 主机的域名
  location.pathname 返回当前页面的路径和文件名
  location.port 返回 web 主机的端口 (80 或 443)
  location.protocol 返回所使用的 web 协议(http:// 或 https://)


4.1 向上向下舍入
Math.ceil()执行向上舍入,即它总是将数值向上舍入为最接近的整数;
Math.floor()执行向下舍入,即它总是将数值向下舍入为最接近的整数;
Math.round()执行标准舍入,即它总是将数值四舍五入为最接近的整数(这也是我们在数学课上学到的舍入规则)。


Math()后面对象
abs(x) 返回数的绝对值。
acos(x) 返回数的反余弦值。
asin(x) 返回数的反正弦值。
atan(x) 以介于 -PI/2 与 PI/2 弧度之间的数值来返回 x 的反正切值。
atan2(y,x) 返回从 x 轴到点 (x,y) 的角度(介于 -PI/2 与 PI/2 弧度之间)。
ceil(x) 对数进行上舍入。
cos(x) 返回数的余弦。
exp(x) 返回 e 的指数。
floor(x) 对数进行下舍入。
log(x) 返回数的自然对数(底为e)。
max(x,y) 返回 x 和 y 中的最高值。
min(x,y) 返回 x 和 y 中的最低值。
pow(x,y) 返回 x 的 y 次幂。
random() 返回 0 ~ 1 之间的随机数。
round(x) 把数四舍五入为最接近的整数。
sin(x) 返回数的正弦。
sqrt(x) 返回数的平方根。
tan(x) 返回角的正切。
toSource() 返回该对象的源代码。
valueOf() 返回 Math 对象的原始值。






5.面向对象
  
  面向对象语言的要求
    一种面向对象语言需要向开发者提供四种基本能力:
    封装 - 把相关的信息(无论数据或方法)存储在对象中的能力
    聚集 - 把一个对象存储在另一个对象内的能力
    继承 - 由另一个类(或多个类)得来类的属性和方法的能力
    多态 - 编写能以多种方法运行的函数或方法的能力


    prototype  (通过已有的方法创建新方法)
    调用 apply() 方法时,第一个参数仍是 obj,说明应该赋予 sayColor() 函数中的 this 关键字值是 obj。


    第二个参数是由两个字符串构成的数组,
    与 sayColor() 函数中的参数 sPrefix 和 sSuffix 匹配调用 call() 方法时,第一个参数是 obj,
    说明应该赋予 sayColor() 函数中的 this 关键字值是 obj。第二个和第三个参数是字符串。


6 PHP 


  PHP global 关键词
  global 关键词用于访问函数内的全局变量。


  PHP static 关键词
  通常,当函数完成/执行后,会删除所有变量。


  PHP echo 和 print 语句
    echo 和 print 之间的差异:
    echo - 能够输出一个以上的字符串
    print - 只能输出一个字符串,并始终返回 1


  PHP var_dump() 会返回变量的数据类型和值:
  PHP var_dump() 会返回变量的数据类型和值:
  PHP strlen() 函数
    strlen() 函数返回字符串的长度,以字符计。
  PHP strpos() 函数
    strpos() 函数用于检索字符串内指定的字符或文本。
      设置 PHP 常量
      如需设置常量,请使用 define() 函数 - 它使用三个参数:
        首个参数定义常量的名称
        第二个参数定义常量的值
        可选的第三个参数规定常量名是否对大小写敏感。默认是 false。
  PHP count() 函数
    获得数组的长度 
      count() 函数用于返回数组的长度(元素数):


  PHP - 数组的排序函数
    sort() - 以升序对数组排序
    rsort() - 以降序对数组排序
    asort() - 根据值,以升序对关联数组进行排序
    ksort() - 根据键,以升序对关联数组进行排序
    arsort() - 根据值,以降序对关联数组进行排序
    krsort() - 根据键,以降序对关联数组进行排序


  PHP 全局变量 - 超全局变量
    PHP 中的许多预定义变量都是“超全局的”,这意味着它们在一个脚本的全部作用域中都可用。
    在函数或方法中无需执行 global $variable; 就可以访问它们。
    这些超全局变量是:
      $GLOBALS
      $_SERVER
      $_REQUEST
      $_POST
      $_GET
      $_FILES
      $_ENV
      $_COOKIE
      $_SESSION


  PHP Date() 函数
    PHP Date() 函数把时间戳格式化为更易读的日期和时间。
      语法
        date(format,timestamp)


  PHP mktime() 
    $d=mktime(9, 12, 31, 6, 10, 2015);


  通过 PHP strtotime() 用字符串来创建日期
    语法
      strtotime(time,now)


  HP include 和 require 语句
    通过 include 或 require 语句,可以将 PHP 文件的内容插入另一个 PHP 文件(在服务器执行它之前)。
      include 和 require 语句是相同的,除了错误处理方面:
        require 会生成致命错误(E_COMPILE_ERROR)并停止脚本
        include 只生成警告(E_WARNING),并且脚本会继续


  PHP readfile() 函数
    readfile() 函数读取文件,并把它写入输出缓冲。
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值