java

1. Email: \b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

2. 匹配中文字符的正则表达式: [\u4e00-\u9fa5]

3. 匹配双字节字符(包括汉字在内):[^\x00-\xff]

4. 匹配空白行的正则表达式:\n\s*\r


清空file
<input type="file" id="fileupload" name="file" />

第一种: (display:none时不能用)

var obj = document.getElementById('fileupload') ; 
obj.select(); 
document.selection.clear();


第二种:(无论display:none或block都可以用)

var obj = document.getElementById('fileupload') ; 
obj.outerHTML=obj.outerHTML; 

 

if key=37 then ShowMessage( '左 ')
else if key=38 then ShowMessage( '上 ')
else if key=39 then ShowMessage( '右 ')
else if key=40 then ShowMessage( '下 ')


判断IE浏览器,老方法
 engine = null;
  alert(window.navigator.appName);
  if (window.navigator.appName == "Microsoft Internet Explorer")
  {
     // This is an IE browser. What mode is the engine in?
       alert(document.documentMode);
     if (document.documentMode) // IE8
        engine = document.documentMode;
     else // IE 5-7
     {
        engine = 5; // Assume quirks mode unless proven otherwise
        if (document.compatMode)
        {
           if (document.compatMode == "CSS1Compat")
              engine = 7; // standards mode
        }
     }
     // the engine variable now contains the document compatibility mode.
  }

你可能感兴趣的:(java)