This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openApp(openUrl, callback) { | |
//检查app是否打开 | |
function checkOpen(cb){ | |
var _clickTime = +(new Date()); | |
function check(elsTime) { | |
if ( elsTime > 7000) { // 7000 = 5000 + toast的 2000 | |
cb(1); | |
} else { | |
cb(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openApp(openUrl, callback) { | |
//检查app是否打开 | |
function checkOpen(cb){ | |
var _clickTime = +(new Date()); | |
function check(elsTime) { | |
if ( elsTime > 7000) { // 7000 = 5000 + toast的 2000 | |
cb(1); | |
} else { | |
cb(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* gulp | |
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev | |
*/ | |
// Load plugins | |
var gulp = require('gulp'), | |
sass = require('gulp-ruby-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
cssnano = require('gulp-cssnano'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Jade 简单使用示例 | |
####**安装** | |
`npm install jade -g` | |
####**指令** | |
`jade --help` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onbeforeunload = onbeforeunload_handler; | |
window.onunload = onunload_handler; | |
function onbeforeunload_handler(){ | |
var warning="确认退出?"; | |
return warning; | |
} | |
function onunload_handler(){ | |
var warning="谢谢光临"; | |
alert(warning); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [1,2,2,4,2]; | |
for(var i =0; i< arr.length; i++){ | |
for(var j=i+1; j<arr.length; j++){ | |
if( arr[i] == arr[j] ){ | |
arr.splice(j,1); | |
j--; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
评分 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ajax(url, fnOnSucc, fnOnFaild) | |
{ | |
var oAjax=null; | |
//1.初始化Ajax对象 | |
if(window.ActiveXObject) | |
{ | |
oAjax=new ActiveXObject("Msxml2.XMLHTTP")||new ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @function:generateRandomAlphaNum->生成随机的字符串 | |
* @param:len->生存随机字符串的长度 | |
* @tdd->IE6-9 chrome Firefox通过测试 | |
* | |
*/ | |
function generateRandomAlphaNum(len) { | |
var rdmString = ""; | |
//toSting接受的参数表示进制,默认为10进制。36进制为0-9 a-z | |
for (var i=0; rdmString.length < len; rdmString += Math.random().toString(36).substr(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 这里把符合以下条件的对象称为伪数组 | |
* 1,具有length属性 | |
* 2,按索引方式存储数据 | |
* 3,不具有数组的push,pop等方法 | |
* | |
*/ | |
//将伪数组转换成数组,ps:已测试IE6-10、chrome、Firefox | |
function toArray(arg){ |
NewerOlder