JS浏览器特性操作

  • //禁用浏览器右键
ContractedBlock.gif ExpandedBlockStart.gif 禁用浏览器右键
 function forbiddenRightKey()
ExpandedBlockStart.gifContractedBlock.gif    

        function nocontextmenu()
ExpandedSubBlockStart.gifContractedSubBlock.gif        

            var oEvent
=window.event||arguments[0];
            oEvent.cancelBubble 
= true 
            oEvent.returnValue 
= false
            
return false
        }
 
        function norightclick(e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        

            
if (window.Event)
ExpandedSubBlockStart.gifContractedSubBlock.gif            

                
if (e.which == 2 || e.which == 3
                
return false
            }

            
else if (event.button == 2 || event.button == 3)
ExpandedSubBlockStart.gifContractedSubBlock.gif            

                
event.cancelBubble = true 
                
event.returnValue = false
                
return false
            }

        }
  
        document.oncontextmenu 
= nocontextmenu; // for IE5+ 
        document.onmousedown = norightclick; // for all others
    }
  • 层的悬浮和隐藏
ContractedBlock.gif ExpandedBlockStart.gif 悬浮隐藏某DIV

    
//悬浮某DIV
ExpandedBlockStart.gifContractedBlock.gif
    function popupDiv(div_id) {   
        var div_obj 
= $("#"+div_id);  
        var windowWidth 
= document.body.clientWidth;       
        var windowHeight 
= document.body.clientHeight;  
        var popupHeight 
= div_obj.height();       
        var popupWidth 
= div_obj.width();    
        
//添加并显示遮罩层   
        $("<div id='mask'></div>").addClass("mask")   
                                  .width(windowWidth )   
                                  .height(windowHeight)    
                                  .appendTo(
"body")   
                                  .fadeIn(
1);   
ExpandedSubBlockStart.gifContractedSubBlock.gif        div_obj.css(
{"position""absolute"})   
               .css(
"z-index","9999")
ExpandedSubBlockStart.gifContractedSubBlock.gif               .animate(
{left: windowWidth/2-popupWidth/2,    
                         top: windowHeight
/2-popupHeight/2, opacity: "show" }
"slow");   
                        
    }
   
    
//隐藏某DIV  
ExpandedBlockStart.gifContractedBlock.gif
    function hideDiv(div_id) {   
        $(
"#mask").remove();   
ExpandedSubBlockStart.gifContractedSubBlock.gif        $(
"#" + div_id).animate({left: 0, top: 0, opacity: "hide" }"slow");   
    }
    



转载于:https://www.cnblogs.com/yuiely/archive/2009/09/04/1560328.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值