複製代碼 代碼如下: <!-- To change this template, choose Tools | Templates and open the template in the editor. --> <!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html;
(1)OnKeyPress 事件驗證 用來驗證輸入操作 複製代碼 代碼如下: function OnKeyPressValidate(obj, event, len) { var e = window.event || event; var key = e.keyCode ? e.keyCode : e.which; var selectedText = ""; if (window.getSelection) { var st = obj.selectionStart; var ed =
代碼如下: 複製代碼 代碼如下: var st="A[B]C[D]E[F]G"; var reg =/\[\w\]/ig; var s1 = st.replace(reg,""); var s2=[]; var arr; while((arr=reg.exec(st))!=null)s2.push(arr[0]); alert(s1); alert(s2.join("")); FF下正確顯示,IE下S2為空白. 網上查不到資料,請各位指點一二. 查詢過程中得了個意外收穫 複製代碼 代碼如下:
複製代碼 代碼如下:function checkIP() { var ipArray,ip,j; ip = document.ipform.ip.value; if(/[A-Za-z_-]/.test(ip)){ if (ip.indexOf(" ")>=0){ ip = ip.replace(/ /g,""); document.ipform.ip.value = ip; } if (ip.toLowerCase().indexOf("http://")==0){ ip =
主要使用的有下面三種:1. (...)Grouping. Group items into a single unit that can be used with *, +, ?, |, and so on. Also remember the characters that match this group for use with later references.2. (?:...)Grouping only. Group items into a single unit,