JS PHP 乱入

原创
2016-07-29 08:59:38 722浏览
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学习资料


// 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 // for(i=0; 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 // 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 for(i=0; i
return self.apply(o, args);
};
};
}



























































































标题

插件编写模式
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 = ''
$('//m.sbmmt.com/m/faq/#' + this.options.dom).css("position", "relative").append(html);
},
show: function(msg) {
$('//m.sbmmt.com/m/faq/#' + this.errID).text(msg).show();
},
hide: function() {
$('//m.sbmmt.com/m/faq/#' + 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() 函数读取文件,并把它写入输出缓冲。

以上就介绍了JS PHP 乱入,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。