JS PHP 亂入

來源:互聯網
上載者:User
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 = '請輸入正確的手機號'
$('#' + 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.物件導向

物件導向語言的要求
一種物件導向語言需要向開發人員提供四種基本能力:
封裝 - 把相關的資訊(無論資料或方法)儲存在對象中的能力
聚集 - 把一個Object Storage Service在另一個對象內的能力
繼承 - 由另一個類(或多個類)得來類的屬性和方法的能力
多態 - 編寫能以多種方法啟動並執行函數或方法的能力
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教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.