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>