//各種尺寸
//過濾數字
代碼如下:
//特殊用途
代碼如下:
//不緩存
代碼如下:
//正則匹配
代碼如下:匹配中文字符的正則表達式: [\u4e00-\u9fa5]
匹配雙字節字符(包括漢字在內):[^\x00-\xff] 匹配空行的正則表達式:
[\s| ]*\r
匹配HTML標記的正則表達式:/<(.*)>.*<\/\1>|<(.*) \/>/
匹配首尾空格的正則表達式:(^\s*)|(\s*$)(像vbscript那樣的trim函數)
匹配Email地址的正則表達式:w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
匹配網址URL的正則表達式:http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)? 以下是例子: 利用正則表達式限制網頁表單里的文本框輸入內容: 用正則表達式限制只能輸入中文:onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"
1.用正則表達式限制只能輸入全角字符: onkeyup="value=value.replace(/[^\uFF00-\uFFFF]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\uFF00-\uFFFF]/g,''))"
2.用正則表達式限制只能輸入數字:onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
3.用正則表達式限制只能輸入數字和英文:onkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
//消除圖像工具欄
代碼如下: or
//無提示關閉
代碼如下:function Close() { var ua=navigator.userAgent var ie=navigator.appName=="Microsoft Internet Explorer"?true:false if(ie) { var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))) if(IEversion< 5.5) { var str = '';
document.body.insertAdjacentHTML("beforeEnd", str);
document.all.noTipClose.Click(); } else {
window.opener =null;
window.close(); } } else {
window.close() } }
//取得控件得絕對位置(1)
代碼如下:
//setTimeout增加參數
代碼如下:
//readyState是xmlhttp返回數據的進度,0=載入中,1=未初始化,2=已載入,3=運行中,4=完成
//組件是否安裝
isComponentInstalled("{6B053A4B-A7EC-4D3D-4567-B8FF8A1A5739}", "componentID"))
//檢查網頁是否存在
代碼如下:function CheckURL(URL) { var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.Open("GET",URL, false); try {
xmlhttp.Send(); var result = xmlhttp.status; } catch(e) {return(false); } if(result==200) { return true;
} xmlhttp = null; return false;
}
//連接數據庫
代碼如下:
//圖象按比例
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com