📄 login_edit.js
字号:
/***************鼠标拖动层代码************************/
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var y,x;
var oDragObj;
var oZindex;
//var zindex=10;//取出每个层的ZINDEX
function myMoveMouse(evt) {
if (isdrag) {
evt = evt || window.event;
oDragObj.style.top = (nTY + evt.clientY - y)+"px";
oDragObj.style.left = (nTX + evt.clientX - x)+"px";
return false;
}
}
function initDrag(evt,obj) {
//var zindex = document.getElementById(obj).value;
var z = document.getElementById(obj);
var zindex =z.style.zIndex;
//alert(zindex);
var oe = nn6 ? evt.target : event.srcElement;
//var topElement = "HTML";
while (oe.tagName!="HTML" && oe.style.position!="relative" && oe.style.position!="absolute"){
oe = nn6 ? oe.parentNode : oe.parentElement;
}
isdrag = true;
if(!oDragObj){
oZindex = oe.style.zIndex;
oe.style.zIndex = zindex+15;
}
if (oDragObj && oe!=oDragObj){
oDragObj.style.zIndex = oZindex;
oZindex = oe.style.zIndex;
oe.style.zIndex = zindex+15;
}
nTY = parseInt(oe.style.top+0);
y = nn6 ? evt.clientY : event.clientY;
nTX = parseInt(oe.style.left+0);
x = nn6 ? evt.clientX : event.clientX;
oDragObj = oe;
document.onmousemove=myMoveMouse;
//alert('aaa');
return false;
}
/*document.onmousedown=initDrag;
document.onmouseup=function(){
isdrag=false;
}*/
function upDrag(obj){
//alert('dadwa');
check(obj);
isdrag=false;
}
/********************
这个check函数是获取对象的真实坐标的函数
这个函数其实是起着承上启下的作用
连接上面的鼠标拖动函数,又连接到下面的ajax函数
*********************/
function check(obj)
{
var b = document.getElementById(obj); //获取ID为a的对象并赋值给b
var oRect = b.getBoundingClientRect(); //获取对象的getBoundingClientRect的属性
var x = oRect.left; //获取对象当前的X轴坐标
var y = oRect.top; //获取对象当前的Y轴坐标
// var r = oRect.right;
// var b = oRect.bottom;
// var h = b-y;
// var w = r-x;
//if()
//{
// var imgobj = document.getElementById("img"+obj);
//
// var w = imgobj.width;
// var h = imgobj.height;
// alert("img"+obj);
//}
//var z = document.getElementById(obj);
//var zindex = z.style.zIndex;
//alert(zindex);
var count = document.getElementById('count').value; //获取数据库总共有多少条记录
document.getElementById('count').value=parseInt(count)+2; //为了判断下次拖动层的覆盖效果,count+1
url="read_move.php?DIV_ID="+obj+"&x="+x+"&y="+y+"&h="+h+"&w="+w+"&count="+count;
//alert(obj);
dopage(obj,url);
}
/*****************鼠标拖动层代码结束********************/
/****************AJAX的调用函数****************/
var http_request=false;
function send_request(url) //初始化,指定处理函数,发送请求的函数
{
http_request=false;
//开始初始化XMLHttpRequest对象
if(window.XMLHttpRequest)
{
//Mozilla浏览器
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType)
{
//设置MIME类别
http_request.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject)
{
//IE浏览器
try
{
http_request=new ActiveXObject("Msxml2.XMLHttp");
}
catch(e)
{
try
{
http_request=new ActiveXobject("Microsoft.XMLHttp");
}
catch(e)
{
}
}
}
if(!http_request)
{
//异常,创建对象实例失败
window.alert("创建XMLHttp对象失败!");
return false;
}
//http_request.onreadystatechange=processrequest;
//确定发送请求方式,URL,及是否同步执行下段代码
http_request.open("GET",url,true);
http_request.send(null);
}
//处理返回信息的函数
function processrequest()
{
var img = "<img src=''margin-top:130px; margin-left:250px'>";
//上面一张为显示图片的地址
if(http_request.readyState==4)
{
//判断对象状态
if(http_request.status==200)
{
//信息已成功返回,开始处理信息
document.getElementById(reobj).innerHTML=http_request.responseText;
}
else
{
//页面不正常
alert("您所请求的页面不正常!");
}
}
else
{
document.getElementById(reobj).innerHTML = img;
}
}
//需要在页面中调用的函数
function dopage(obj,url)
{
//document.getElementById(obj).innerHTML="天拉地啊人啊...";
reobj = obj;
send_request(url);
//alert('ss');
}
/*******************AJAX函数调用完毕*******************/
/************当鼠标滑到对象和滑出对象对该对象的class的操作*****************/
function over(obj) //当鼠标经过的时候,对象的calss变成contenth
{
var obj=document.getElementById(obj);
obj.className='contenth';
}
function out(obj) //当鼠标移出去的时候,对象的calss变成content
{
var obj=document.getElementById(obj);
obj.className='content';
}
/*******************对对象的class操作完成****************/
///*************鼠标右键菜单脚本****************************/
/*-----------------------------------------------------------
///**************************鼠标事件结束**************************************/
//------------------隐藏脚本------------------------------//
ie4=(document.all)?true:false;
ns4=(document.layers)?true:false;
function toExit(){
var args=toExit.arguments;
var visible=args[0];
if(ns4){
theObj=eval("document.layers[\'"+args[1]+"\']");
if(theObj)theObj.visibility=visible;
}
else if(ie4){
if(visible=='show')visible='visible';
if(visible=='hide')visible='hidden';
theObj=eval("document.all[\'"+args[1]+"\']");
if(theObj)theObj.style.visibility=visible;
}
}
//----------------下拉菜单 按钮-----------//
function menuControl(show)
{
window.event.cancelBubble=true;
var objID=event.srcElement.id;
var index=objID.indexOf("_");
var mainID=objID.substring(0,index);
var numID=objID.substring(index+1,objID.length);
if(mainID=="menubar")
{
if(show==1)
{
eval("showMenu("+"menu_"+numID+")");
}
else
{
eval("hideMenu("+"menu_"+numID+")");
}
}
}
var nbottom=0,speed=7;
function displayMenu(obj)
{
obj.style.clip="rect(0 100% "+nbottom+"% 0)";
nbottom+=speed;
if(nbottom<=100)
{
timerID=setTimeout("displayMenu("+obj.id+"),70");
}
else clearTimeout(timerID);
}
function showMenu(obj)
{
obj.style.display="block";
obj.style.clip="rect(0 0 0 0)";
nbottom=5;
displayMenu(obj);
}
function hideMenu(obj)
{
nbottom=0;
obj.style.display="none";
}
function keepMenu(obj)
{
obj.style.display="block";
}
function dbClickStopDrag(id){
var objID = document.getElementById(id);
//objID.onmousedown = "";
//objID.onmouseup = "";
}
function getVarByTmpDiv(id){
var objTmpDiv = document.getElementById('tmpdiv');
objTmpDiv.value = id;
}
function del(){
id = getElementById('tmpdiv').value
url="del.php?div_id="+id;
window.open(url)
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -