Chinaunix首页 | 论坛 | 博客
  • 博客访问: 415412
  • 博文数量: 112
  • 博客积分: 4000
  • 博客等级: 上校
  • 技术积分: 905
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-05 21:14
文章分类

全部博文(112)

文章存档

2009年(3)

2008年(24)

2007年(55)

2006年(30)

我的朋友

分类:

2007-08-24 16:14:04

文件: search3.0.rar
大小: 206KB
下载: 下载
 var exp=new Date();
 exp.setTime(exp.getTime()+(30*24*60*60*1000));
 var beginMoving=false;
 var flagCookie = false;
 window.onload = init;
function init()
{
 checkCount();
 flagCookie = true;
 var getcontent =GetCookie('count');
 var nameC = ""; //根据什么提取的信息
 var contentcookie; //cookie中提取的信息
 var oneContent;  //提取出来的内容
 var oneStyle;  //提取出来的样式
 
 //从cookie中提取出来值
 if(getcontent!=null&&flagCookie){
    flagCookie =false;
  for(m=0;m   nameC = m+"=";
   contentcookie=  GetConent(getcontent,nameC);
   oneContent= getOneContenVal(contentcookie)
   oneStyle = getOneContenStyle(contentcookie);
   secTable.cells[m].className=oneStyle;
   secTable.cells[m].innerHTML=oneContent;
  }
 }
 
}
//鼠标移动--开始
function MouseDownToMove(obj){
 obj.style.zIndex=1;
 obj.mouseDownY=event.clientY;
 obj.mouseDownX=event.clientX;
 beginMoving=true;
 obj.setCapture();
}
function MouseMoveToMove(obj){
  if(!beginMoving) return false;
  obj.style.top = (event.clientY-obj.mouseDownY);
  obj.style.left = (event.clientX-obj.mouseDownX);
  obj.style.cursor="move";
  obj.style.filter="alpha(opacity=70)";
}
function MouseUpToMove(obj){
 if(!beginMoving) return false;
 obj.releaseCapture();
 obj.style.top=0;
 obj.style.left=0;
 obj.style.zIndex=0;
 beginMoving=false;
 
 var tempRowIndex = 0;
 var tempRows = 0 ;
 var templeft=obj.mouseDownX-event.clientX;
 var i= 0;
 var cellIndex = obj.cellIndex;
 var content = obj.innerHTML;
 var style= obj.className;
 
 if(templeft<0){
 //从前面往后走
 templeft=event.clientX-obj.mouseDownX;
 tempCellIndex =(templeft-templeft%117)/117;
 i = cellIndex + tempCellIndex+1;
 }else{
 //从后面往前走
 tempCellIndex =(templeft-templeft%117)/117;
 i = cellIndex - tempCellIndex; 
 }
 
 var myTD = obj.parentElement.insertCell(i);
 myTD.onmousedown = function (){MouseDownToMove(myTD);};
 myTD.onmouseup = function (){MouseUpToMove(myTD);};
 myTD.onmousemove = function (){MouseMoveToMove(myTD);};
 myTD.onmouseover = function (){secBoard(myTD);};
 myTD.onmouseout = function (){out(i);};
 myTD.className = style;
 myTD.innerText = content;
 tempRows =0;
 obj.parentElement.deleteCell(obj.cellIndex);
}
//页面显示
 function secBoard(obj)
  {
  cookieContent = "0="+secTable.cells[0].innerHTML+","+secTable.cells[0].className+
      ";1="+secTable.cells[1].innerHTML+","+secTable.cells[1].className+
      ";2="+secTable.cells[2].innerHTML+","+secTable.cells[2].className+
      ";3="+secTable.cells[3].innerHTML+","+secTable.cells[3].className+";"; 
     var flag=null;//内容
  var flag2 = 0;//样式
  
  for(i=0;i   secTable.cells[i].className="sec1";
   obj.className="sec2";
  }
  for(i=0;i   mainTable.tBodies[i].style.display="none";
   if(mainTable.tBodies[i].id == obj.innerHTML)flag=i;  
  }
  if(flag!=null){mainTable.tBodies[flag].style.display="block";}
       amt();//启动cookie
 
  }
  function out(m){document.getElementById("div" + m).style.display='none';}
  function over(m){document.getElementById("div" + m).style.display="";}
//cookie操作
 
  function amt(){
 if(cookieContent==null&&!flagCookie){return false};
  var content = cookieContent;
  var count = GetCookie('count');
  if(count == null){
      SetCookie('count',content);
    return true;
  }else{
    DeleteCookie('count');
    SetCookie('count',content,exp);
    return true;
 }
  
}
      
  function GetConent(content,name){
   var l = name.length;
   var len = content.length;
   var n =0;
   while(n   var j = n + l;
   if(content.substring(n,j)==name) return getContenVal(content,j);
   n = content.indexOf(";", n) + 1;
   if (n == 0) break;
  }
  }
  function getContenVal(content,offset){
     var endstr = content.indexOf(";",offset);
  if(endstr == -1) endstr = content.length;
  return unescape(content.substring(offset,endstr));
  } 
  function getOneContenVal(content){
     var endstr1 = content.indexOf(",",0);
  return unescape(content.substring(0,endstr1));
  }  
  function getOneContenStyle(content){
     var endstr2 = content.indexOf(",",0)+1;
  return unescape(content.substring(endstr2,content.length));
  }  

//设置Cookie
function GetCookie (name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
  return getCookieVal (j);
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break;
 }
 return null;
}

function getCookieVal(offset) {
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
 endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}
 
function SetCookie (name, value) {
 var argv = SetCookie.arguments;
 var argc = SetCookie.arguments.length;
 var expires = (argc > 2) ? argv[2] : null;
 var path = (argc > 3) ? argv[3] : null;
 var domain = (argc > 4) ? argv[4] : null;
 var secure = (argc > 5) ? argv[5] : false;
 document.cookie = name + "=" + escape (value) +
 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
 ((path == null) ? "" : ("; path=" + path)) +
 ((domain == null) ? "" : ("; domain=" + domain)) +
 ((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
 var exp = new Date();
 exp.setTime (exp.getTime() - 1);
 var cval = GetCookie (name);
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function switchTab(tab)
{
 var oItem = document.getElementById("menu_tr").getElementsByTagName("div");
    for(var i=0; i  var x = oItem[i];
  x.className = "bj";
 }
    document.getElementById(tab).className = "bj1";
   
}
阅读(1466) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~