js 屏蔽右键,加入收藏夹,设为主页

-----------------------------------------------------------------------------------------------------------------css

@charset "gb2312";
/* CSS Document */

body{
margin:0;
margin-top:3px;
padding:0;
font-size:12px;
line-height:20px;
color:#333;
}
.header{
margin-left:auto;
margin-right:auto;
width:720px;
}
.logo{
float:left;
width:600px;
}
.header_right{
width:120px;
color:#060;
text-decoration:none;
float:right;
cursor:pointer;
padding-top:15px;
}
.menu{
float:none;
clear:both;
}
.main{
width:95%;
margin-left:auto;
margin-right:auto;
}
.left_indent{
padding-left:20px;
}
.red{
color:#F00;
}

-----------------------------------------------------------------------------------------------------------------js

function setHomePages(){
/*if(document.all){*/
document.documentElement.style.behavior="url(#default#homepage)";
document.documentElement.setHomePage('http://www.ifindu.com.cn');
/*}
else if(window.sidebar){
 if (window.netscape) {
       try {
          netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
         }
      catch (e) {
          alert("该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
       }
       }
      var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
     prefs.setCharPref("browser.startup.homepage", "http://www.ifindu.com.cn");
}*/
}
function addCookie(){//加入收藏夹
if(document.all){
window.external.addFavorite('http://www.ifindu.com.cn','六人行');
}
else if(window.sidebar){
window.sidebar.addPanel('六人行','http://www.ifindu.com.cn','');
}
}
function click(){
alert('您这是干什么呢?') //点击右键时,弹出警告框,屏蔽右键
return false;
}
document.οncοntextmenu=click;

-----------------------------------------------------------------------------------------------------------------网页源码





JavaScript综合特效




转载于:https://www.cnblogs.com/xiaosen992608/p/4090297.html

你可能感兴趣的:(js 屏蔽右键,加入收藏夹,设为主页)