javascript设为首页、加入收藏

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        *{margin: 0; padding: 0}
        a{text-decoration: none; color: #fff; font-size: 20px; color: #333; text-align: center;}
    </style>
</head>
<body>
<a href="javascript:;" onclick="alert(‘加入收藏失败,请使用Ctrl+D进行添加‘);" title="收藏第一星座网">收藏第一星座网</a> |
<a href="javascript:;" onclick="alert(‘您的浏览器不支持,请按照下面步骤操作:1.打开浏览器设置。2.点击设置网页。3.输入:“www.d1xz.net”点击确定。‘);" title="设为首页">设为首页</a>
</body>
</html>

效果图:

加入收藏:

设为首页:

时间: 2024-08-30 08:54:11

javascript设为首页、加入收藏的相关文章

javascript 设为首页 | 加入收藏夹 JS代码

我们介绍一个可兼容所有浏览器的加入收藏代码代码,大概原理是这样的我们根据获取用户navigator.userAgent.toLowerCase()信息来判断浏览器,根据浏览器是否支持加入收藏js命令,如果可以自动收藏否则就提示ctrl+D手动收藏了. 1 function addFavorite2() { 2 var url = window.location; 3 var title = document.title; 4 var ua = navigator.userAgent.toLowe

Javascript 设为首页 + 加入收藏(全兼容)

//加入收藏夹 function AddFvtgc() { var title = document.title; var url = document.location.href; try { window.external.AddFavorite(url, title); } catch (e) { alert("请按下 Ctrl + D 键将本站加入收藏."); } } //设为首页 function AddHomegc() { var url = document.locati

设为首页/加入收藏代码(仅限IE)

设为首页 <a onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://'+document.location.host);" href="javascript:">设为首页</a> 加入收藏 <a href="javascript:" onClick="window.external.AddFavorit

HTML设为首页/加入收藏代码

(特别注意:要把'这个符号换成无任何输入法状态中输入的'这个符号,否则程序无法运行) 1.文字型: <a onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.apple-wallpaper.com');" href="http://www.apple-wallpaper.com">设为首页</a> 2.按钮型: <input

ASP.NET中怎样将页面设为首页,加入收藏

1.文字js脚本事件:<span onClick="var strHref=window.location.href;this.style.behavior=’url(#default#homepage)’;this.setHomePage(‘http://www.unvs.cn’);" style="CURSOR: hand"> 2.文字链接事件:<a href="#" onClick="window.externa

设为首页、收藏的JS代码

HTML代码中: <a  href="#"    onclick="AddFavorite(window.location,document.title)"  >加入收藏</a> <a  href="#" onclick="SetHome(this,window.location)" >设为首页</a> JS代码: // JavaScript Document // 加入收藏 &

设为首页/加入收藏 代码

// 设置为主页function SetHome(obj,url){   try{        obj.style.behavior='url(#default#homepage)';        obj.setHomePage(url);    }catch(e){        if(window.netscape){           try{               netscape.security.PrivilegeManager.enablePrivilege("Univ

设为首页收藏本站js代码(引自ecshop模板堂(ecmoban.com)

http://help.ecmoban.com/article-1596.html 设为首页 和 收藏本站js代码 兼容IE,chrome,ff,360等 将以下代码放到首页 或者新建js文件 <script type="text/javascript"> //设为首页 www.ecmoban.com function SetHome(obj,url){ try{ obj.style.behavior='url(#default#homepage)'; obj.setHom

设为首页 添加到收藏夹 (share)

设为 设为首页 和 收藏本站js代码 兼容IE,chrome,ff <script type="text/javascript"> //设为首页 function SetHome(obj,url){ try{ obj.style.behavior='url(#default#homepage)'; obj.setHomePage(url); }catch(e){ if(window.netscape){ try{ netscape.security.PrivilegeMan