我想在我的网站的页脚中添加一个名为“添加到收藏夹”的链接。我找不到任何可以执行此操作的模块,所以请问有什么方法可以执行此操作?
十分感谢
我只解释皮特已经说过的话。您需要以某种方式添加此javascript代码,以使“添加到收藏夹”按钮起作用:
<script type="text/javascript">
$(function() {
$('#bookmarkme').click(function() {
if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(document.title,window.location.href,'');
} else if(window.external && ('AddFavorite' in window.external)) { // IE Favorite
window.external.AddFavorite(location.href,document.title);
} else if(window.opera && window.print) { // Opera Hotlist
this.title=document.title;
return true;
} else { // webkit - safari/chrome
alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
}
});
});
</script>
您需要在块或模板中创建链接:
<a href="#" id="bookmarkme">Add to favorite</a>
如果您有自己的主题,则将javascript放在单独的文件中,然后将其添加到主题信息文件中:
scripts[] = myFile.js
您也可以使用durpal_add_js()函数通过自定义模块添加它。
最简单且不推荐的方法是在添加链接后立即将其添加到块主体中。您需要将格式设置为“ Full HTML”或“ PHP”,以使其起作用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句