<li style="width:20px"><img src="images/home.png" alt="首页" /></li>
        <li style="width:65px"><span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)'; this.setHomePage('http://www.tingsoft.cn/');" style="cursor: hand;">设为首页</span></li>
        <li style="width:20px"><img src="images/shoucang.png" alt="加入收藏" /></li>
        <li style="width:65px"><span onclick="javascript:window.external.addFavorite('http://www.tingsoft.cn/','日照清软软件开发有限公司')" style="cursor: hand;">加入收藏</span></li>
        <li style="width:20px"><img src="images/return.png" alt="意见反馈" /></li>
        <li style="width:65px">意见反馈</li>  就是这段代码,主要就是用来 设置主页 和 添加收藏的,在ie中正常云寻个可以设置添加,但是在火狐中就不行了,火狐中是启用了JavaScript的!!!!! 拜求高手解决!!!!!

解决方案 »

  1.   

    IE only 的代码
    。。
    //首先是加入收藏的function addfavorite()
    {
       if (document.all)
       {
          window.external.addFavorite('http://www.tingsoft.cn/','日照清软软件开发有限公司');
       }
       else if (window.sidebar)
       {
          window.sidebar.addPanel('日照清软软件开发有限公司', 'http://www.tingsoft.cn/',  "");
       }
    }<span onclick="javascript:addfavorite()" style="cursor: hand;">加入收藏</span>//下面是设为首页的function setHomepage()
    {
     if (document.all)
        {
            document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage('http://www.tingsoft.cn/');
     
        }
        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.tingsoft.cn/');
     }
    }<span onclick="setHomepage()" style="cursor: hand;">设为首页</span>