原创 方法記
方法記: 1.判斷傳入的對象是否是函數 function isFunction( obj ) { return typeof obj === 'function'; } 2.去除字符串兩頭空格 function trim(str
原创 創建含數字字母的隨機字符串方法
function randomString(len, charSet) { charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
原创 javascript 數組的基本處理函數
原文出處: imweb Array.push();添加元素在數組最後,並返回數組新的長度 Array.pop();刪除最後一個元素,減小數組長度,並返回最後一個元素 Array.unshift();在數組前面添加元素 Ar
原创 多行文本溢出省略號
轉載自: http://jsfiddle.net/Cople/DrML4/5/ html <div class="figcaption"> <p>You probably can't do it (currently?) without
原创 validator
themeMenuForm.validator("setField", "#" + menuids, "required;sameName;tLength;diyRemote"); 點贊 收藏 分享
原创 時間插件-bootstrap-datetimepicker2.3.11
時間插件之結束時間不能小於開始時間 changeDate: function (starttime,stoptime) { //判斷時間的大小彈窗提示用戶 var _t = this
原创 json-server
1.json-server模擬後端數據 json-server --watch todos-data.json 瀏覽器訪問:http://127.0.0.1:3000/todos 點贊 收藏 分享
原创 js刷新頁面
Javascript刷新頁面的幾種方法: 1 history.go(0) 2 location.reload() 3 location=location 4 location.assign(locat
原创 事件冒泡 默認事件
原文出處 1、禁止事件冒泡 function stopBubble(e) { //如果提供了事件對象,則這是一個非IE瀏覽器 if ( e && e.stopPropagation ) //
原创 CSS切割圖片只取圖片中一部分
轉載自 腳本之家 http://www.jb51.net/css/150036.html 方法一:(已驗證) background: url(123.jpg) no-repeat -140px -20px; (位置可以自定義) 方法二
原创 截取url參數
getUrl: function (orderStatus) { var reg = new RegExp("(^|&)" + orderStatus + "=([^&]*)(&|$)",
原创 實時監測輸入字符個數
//轉換漢字字符的記數 getStrLength: function (sStr) { var aMatch = sStr.match(/[^\x00-\x80]/g),
原创 轉義html字符
var htmlspecialchars = function(str) { if(!str) { str = ''; } str = str.replace(/&/g, '&');
原创 typehead.js 0.11.1
typehead.js 1. typehead.js的機制主要是當keyup的時候拿到數據,然後展示在對應的位置,我們引用這個插件之後需要做的只有一件事,那就是怎麼引用數據 2. 關於 引用數據,分爲本地數據,ajax數據,r
原创 字符串漢字記數
var strLength = function (str) { //此處的正則是爲了匹配全角字符 var aMatch = str.match(/[^\x00-\x80]/g),