js添加到收藏夹中代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.jzread.com/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js添加到收藏夹中代码</title>
<script language="javascript">
//添加到收藏夹中
function addFavorite(site_url,site_name)
{
var the_pagetitle=site_name;
var the_pageurl=site_url;
if(the_pageurl=="")
{
the_pageurl=window.location.href;
}
if(the_pagetitle=="")
{
the_pagetitle=document.title;
}
//window.external.addFavorite(the_pageurl,the_pagetitle);
if (window.sidebar) {
window.sidebar.addPanel(the_pagetitle,the_pageurl,"");
} else if(document.all) {
//alert(window.external);
window.external.addFavorite(the_pageurl,the_pagetitle);
//window.external.addFavorite('http://www.jzread.com','我的网站名称');
} else if(window.opera && window.print) {
return true;
}
}
</script>
</head>
<body>
<a href="javascript:void(0)" onclick="javascript:addFavorite('http://www.jzread.com','建站教学网');">加入收藏</a>
</body>
</html>