获取html绝对坐标 屏蔽Ctrl+V 按回车键直接登录 js代码

获取html绝对坐标

function findPosition(oElement) {
	var x2 = 0;
	var y2 = 0;
	var width = oElement.offsetWidth;
	var height = oElement.offsetHeight;
	//alert(width + "=" + height);
	if (typeof (oElement.offsetParent) != 'undefined') {
		var posY = 0
		for ( var posX = 0; oElement; oElement = oElement.offsetParent) {
			posX = posX + oElement.offsetLeft;
			posY = posY + oElement.offsetTop;
		}
		x2 = posX + width;
		y2 = posY + height;
		return [ posX, posY, x2, y2 ];
	} else {
		x2 = oElement.x + width;
		y2 = oElement.y + height;
		return [ oElement.x, oElement.y, x2, y2 ];
	}
}


屏蔽Ctrl+V 屏蔽Ctrl+V 

function NoPaste(){   //屏蔽   Ctrl+V    
    if   ((event.ctrlKey)&&(event.keyCode==86))         
    {    
          event.keyCode=0;   
          event.returnValue=false;   
    }   
};

按回车键直接登录



        function  document.onkeydown()   
        {   
        	if(event.keyCode == 13 && 'resetid' != document.activeElement.id)   
        	{
        	   try{
        		 LoginIn();   
        	   }catch(e){
        	   }
        	}   
        } 


 

你可能感兴趣的:(html,function)