小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

復(fù)制、收藏的兼容性代碼

 小陳 2007-04-27

1、復(fù)制到剪貼板。

程序代碼 程序代碼

function copy(text){
     if(window.clipboardData){//判斷是否具有clipboardData對象,IE
         window.clipboardData.setData("Text",text);
     }else if(window.netscape){//判斷是否存在netscape對象,F(xiàn)F
         try{//用try來嘗試使用對象
             netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
         }catch(e){//如果不能使用剪貼板,提示用戶出錯
             alert(‘您的firefox安全限制限制您進(jìn)行剪貼板操作。\n請打開 "about:config" 將signed.applets.codebase_principal_support "設(shè)置為true" 之后重試‘);
             return false;
         }
         var clip,trans,str={},clipid;
         if(!(clip=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard))) return;
         if(!(trans=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable))) return;
         trans.addDataFlavor("text/unicode");
         str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
         str.data=text;
         trans.setTransferData("text/unicode",str,text.length*2);
         clipid=Components.interfaces.nsIClipboard;
         try{
             clip.setData(trans,null,clipid.kGlobalClipboard);
         }catch(e){return false}
     }
}


2、添加到收藏夾。
程序代碼 程序代碼
function addBookmark(title,url){
     if(window.sidebar){//判斷是否具有sidebar對象,F(xiàn)F
         try{//如果url不是以http://或者ftp://或者https://開頭的,會出錯
             window.sidebar.addPanel(title,url,"");
         }catch(e){}
     }else if(window.external.AddFavorite){//判斷是否具有AddFavorite方法,IE
         window.external.AddFavorite(url,title);
     }
}

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多