IE6、IE7 的“加入收藏”代码:
2008-03-26 11:46
197 查看
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
IE6、IE7 的“加入收藏”代码:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
window.external.addFavorite(sURL, sTitle);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
两点说明:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
addFavorite 的第一个字母 a 不是大写!纵然微软参考上是大写,但“事实胜于雄辩”。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
IE7 是支持这个代码的,如果您的 IE7 不支持,那么请重新下载更新版的 IE7 进行安装。比如:Internet Explorer(IE7) For XP V7.0.5730.11。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
--------------------------------------------------------------------------------
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
Firefox 的“加入收藏”代码:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
方法一、
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<a href="http://www.cftea.com/" title="千一网络 - 网页技术 永无止境" rel="sidebar">加入收藏</a>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
关键在于 rel="sidebar";href 属性值作为收藏网址;title 作为收藏名称。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
方法二、
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
window.sidebar.addPanel(sTitle, sURL, "");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
第一个参数是收藏名称;第二个参数是收藏网址;第三个是自定义 Tab 所需的 URL,为零长度字符串即可。注意参数顺序与 addFavorite 不同。我们推荐第二种方法。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
不论哪一种方法,加入收藏夹后,单击收藏的项目都是在侧边栏(sidebar)中打开网页,要在主窗口中打开只有两种办法:法一是右键打开;法二是右键改其属性。这不能不说是 Firefox 收藏夹的遗憾。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
完整代码:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<?xml version="1.0" encoding="gb2312"?>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<html xmlns="http://www.w3.org/1999/xhtml">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<head>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<title>兼容 IE6、IE7、FF 的“加入收藏”</title>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</head>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<body>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
<script type="text/javascript" language="javascript">...
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<!--
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
function AddFavorite(sURL, sTitle)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
window.external.addFavorite(sURL, sTitle);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch (e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
window.sidebar.addPanel(sTitle, sURL, "");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch (e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert("加入收藏失败,有劳您手动添加。");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
-->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<p>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<a href="#" onclick="javascript:AddFavorite('http://www.cftea.com/', '千一网络 - 网页技术 永无止境');return false">加入收藏</a>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</p>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</body>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</html>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
相关文章推荐
- 兼容IE6、IE7和FireFox的“加入收藏”代码
- 兼容IE6、IE7和FireFox的“加入收藏”代码
- 兼容各类主流浏览器IE6、IE7、FF、Opera的加入收藏代码
- Javascript 兼容 IE6、IE7、FF 的“加入收藏”“设为首页”
- javascript 兼容 IE6、IE7、FF 的“加入收藏”
- javascript 兼容 IE6、IE7、FF 的“加入收藏”
- 兼容IE6、7、8和Firefox的“加入收藏”、“设为首页"javascript代码片段
- 兼容 IE6、IE7、FF 的“加入收藏”
- Javascript 兼容 IE6、IE7、FF 的“加入收藏”“设为首页”
- javascript 兼容 IE6、IE7、FF 的“加入收藏”“设为首页”
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- 网页头一定要加的代码段(加注版)一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10(转)
- 收藏的一行代码加速IE6的JS的高效方法
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- HTML设为首页/加入收藏代码