IE 와 화 호 를 홈 페이지 와 컬 렉 션 으로 호 환 하 는 예

top
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
function addCookie()    
{    
 if (document.all)    
    {    
	   alert("  ie");
       window.external.addFavorite('http://www.hao123.com','     ');    
    }    
    else if (window.sidebar)    
    {    
	   alert("    ");
       window.sidebar.addPanel('     ', 'http://www.hao123.com', "");    
 }    
}    
function setHomepage()    
{    
 if (document.all)    
    {    
        document.body.style.behavior='url(#default#homepage)';    
  document.body.setHomePage('http://www.baidu.com');    
     
    }    
    else if (window.sidebar)    
    {    
    if(window.netscape)    
    {    
         try   
   {      
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");      
         }      
         catch (e)      
         {      
    alert( "         ,        ,         about:config,     signed.applets.codebase_principal_support    true" );      
         }    
    }     
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);    
    prefs.setCharPref('browser.startup.homepage','http://www.baidu.com');    
 }    
}    



</script>
<title>top</title>

</head>

<body> 
<ol>   
<li><a href="javascript:;" onClick="addCookie()">     (IE、Firefox  )</a></li>   
<li><a href="javascript:;" onClick="setHomepage()">     (IE、Firefox  )</a></li>   
</ol>   

</body>
</html>

좋은 웹페이지 즐겨찾기