Admin.js
上传用户:dbstep
上传日期:2022-08-06
资源大小:2803k
文件大小:14k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

ASP/ASPX

  1. //改变管理位置标记--------------------------------------------------------------
  2. function changeAdminFlag(Content){
  3.    var row=parent.parent.headFrame.document.all.Trans.rows[0];
  4.    row.cells[3].innerHTML = Content ;
  5.    return true;
  6. }
  7. //删除各种分类节点--------------------------------------------------------------
  8. function ConfirmDelSort(Result,ID)
  9. //删除视频分类节点--------------------------------------------------------------
  10. {
  11.    if (confirm("您确实要删除本类、子类及所有下属信息条目吗?"))
  12.    {
  13.        window.location.href=Result+".asp?Action=Del&ID="+ID
  14.    } 
  15. }
  16. //分类节点展开和折叠(备用)-------------------------------------------------------------
  17. function AddToSort(imagePath){
  18.   window.opener.LPform.LPattern.focus();
  19.   window.opener.document.LPform.LPattern.value=imagePath;
  20.   window.opener=null;
  21.   window.close();
  22. }
  23. //类别选择分类------------------------------------------------------------------------
  24. function OpenScript(url,width,height)
  25. {
  26.   var win = window.open(url,"SelectToSort",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
  27. }
  28. //分类节点展开和折叠-------------------------------------------------------------------
  29. function EndSortChange(a,b)
  30. {
  31. if(eval(a).style.display=='')
  32. {
  33. eval(a).style.display='none';
  34. eval(b).className='SortEndFolderOpen';
  35. }
  36. else
  37. {
  38. eval(a).style.display='';
  39. eval(b).className='SortEndFolderClose';
  40. }
  41. }
  42. function SortChange(a,b)
  43. {
  44. if(eval(a).style.display=='')
  45. {
  46. eval(a).style.display='none';
  47. eval(b).className='SortFolderOpen';
  48. }
  49. else
  50. {
  51. eval(a).style.display='';
  52. eval(b).className='SortFolderClose';
  53. }
  54. }
  55. //通用选择删除条目(反选-全选)--------------------------------------------------------
  56. function CheckOthers(form)
  57. {
  58.    for (var i=0;i<form.elements.length;i++)
  59.    {
  60.       var e = form.elements[i];
  61.       if (e.checked==false)
  62.       {
  63.      e.checked = true;
  64.       }
  65.       else
  66.       {
  67.      e.checked = false;
  68.       }
  69.    }
  70. }
  71. function CheckAll(form)
  72. {
  73.    for (var i=0;i<form.elements.length;i++)
  74.    {
  75.       var e = form.elements[i];
  76.       e.checked = true;
  77.    }
  78. }
  79. //相关条目删除提示------------------------------------------------------------
  80. function ConfirmDel(message)
  81. {
  82.    if (confirm(message))
  83.    {
  84.       document.formDel.submit()
  85.    }
  86. }
  87. //调用在线内容编辑器-----------------------------------------------------------
  88. function OpenDialog(sURL, iWidth, iHeight)
  89. {
  90.    var oDialog = window.open(sURL, "_EditorDialog", "width=" + iWidth.toString() + ",height=" + iHeight.toString() + ",resizable=no,left=0,top=0,scrollbars=no,status=no,titlebar=no,toolbar=no,menubar=no,location=no");
  91.    oDialog.focus();
  92. }
  93. //检验输入字符的有效性(0-9,a-z,-,_)-------------------------------------------
  94. function voidNum(argValue) 
  95. {
  96.    var flag1=false;
  97.    var compStr="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
  98.    var length2=argValue.length;
  99.    for (var iIndex=0;iIndex<length2;iIndex++)
  100.    {
  101.    var temp1=compStr.indexOf(argValue.charAt(iIndex));
  102.    if(temp1==-1) 
  103.    {
  104.       flag1=false;
  105. break;
  106.    }
  107.    else
  108.    { flag1=true; }
  109.    }
  110.    return flag1;
  111. //检查管理员登录------------------------------------------------------------------------------
  112. function CheckAdminLogin()
  113. {
  114.    var check; 
  115.    if (!voidNum(document.AdminLogin.LoginName.value))
  116.    {
  117.   alert("请正确输入管理员名称(由0-9,a-z,-_任意组合的字符串)。");
  118.       document.AdminLogin.LoginName.focus();
  119.   return false;
  120.   exit;
  121.    }    
  122.    if (!voidNum(document.AdminLogin.LoginPassword.value))
  123.    {
  124.   alert("请输入管理员密码。");
  125.   document.AdminLogin.LoginPassword.focus();
  126.   return false;
  127.   exit;
  128.    }
  129.    if (!voidNum(document.AdminLogin.VerifyCode.value))
  130.    {
  131.       alert("请正确输入验证码。");
  132.       document.AdminLogin.VerifyCode.focus();
  133.   return false;
  134.   exit;
  135.    }
  136.    return true;
  137. }
  138. //检查编辑管理员------------------------------------------------------------------------------
  139. function CheckAdminEdit()
  140. {
  141.    if (document.editAdminForm.AdminName.value.length<3 || document.editAdminForm.AdminName.value.length>10 )
  142.    {
  143.   alert("请正确输入登录名(由0-9,a-z,-_任意组合3-10位的字符串)。");
  144.       document.editAdminForm.AdminName.focus();
  145.   return false;
  146.   exit;
  147.    }
  148.    var check; 
  149.    if (!voidNum(document.editAdminForm.AdminName.value))
  150.    {
  151.   alert("请正确输入登录名(由0-9,a-z,-_任意组合3-10位的字符串)。");
  152.       document.editAdminForm.AdminName.focus();
  153.   return false;
  154.   exit;
  155.    }
  156. }
  157. //检查编辑会员--------------------------------------------------------------------------------
  158. function CheckMemEdit()
  159. {
  160.    if (document.editMemForm.MemName.value.length<3 || document.editMemForm.MemName.value.length>16 )
  161.    {
  162.   alert("请正确输入登录名(由0-9,a-z,-_任意组合3-16位的字符串)。");
  163.       document.editMemForm.MemName.focus();
  164.   return false;
  165.   exit;
  166.    }
  167.    var check; 
  168.    if (!voidNum(document.editMemForm.MemName.value))
  169.    {
  170.   alert("请正确输入登录名(由0-9,a-z,-_任意组合3-16位的字符串)。");
  171.       document.editMemForm.MemName.focus();
  172.   return false;
  173.   exit;
  174.    }
  175. }
  176. //管理员退出登录提示--------------------------------------------------------------------------
  177. function AdminOut()
  178. {
  179.    if (confirm("您真的要退出管理操作吗?"))
  180.    location.replace("CheckAdmin.asp?AdminAction=Out")
  181. }
  182. //跳转到第几页-------------------------------------------------------------------------------
  183. function GoPage(Myself)
  184. {
  185.    window.location.href=Myself+"Page="+document.formDel.SkipPage.value;
  186. }
  187. //添加选择路径的ID,数字路径及生成文本路径--------------------------------------------------------
  188. function AddSort(SortName,ID,Path)
  189. {
  190. window.opener.editForm.SortName.focus();
  191. window.opener.document.editForm.SortName.value=SortName;
  192. window.opener.document.editForm.SortID.value=ID;
  193. window.opener.document.editForm.SortPath.value=Path;
  194.     window.opener=null;
  195.     window.close();
  196. }
  197. //选择起始日期-----------------------------------------------------------------
  198. var DS_x,DS_y;
  199. function dateSelector()  //构造dateSelector对象,用来实现一个日历形式的日期输入框。
  200. {
  201.   var myDate=new Date();
  202.   this.year=myDate.getFullYear();  //定义year属性,年份,默认值为当前系统年份。
  203.   this.month=myDate.getMonth()+1;  //定义month属性,月份,默认值为当前系统月份。
  204.   this.date=myDate.getDate();  //定义date属性,日,默认值为当前系统的日。
  205.   this.inputName='';  //定义inputName属性,即输入框的name,默认值为空。注意:在同一页中出现多个日期输入框,不能有重复的name!
  206.   this.display=display;  //定义display方法,用来显示日期输入框。
  207. }
  208. function display()  //定义dateSelector的display方法,它将实现一个日历形式的日期选择框。
  209. {
  210.   var week=new Array('日','一','二','三','四','五','六');
  211.   document.write("<style type=text/css>");
  212.   document.write("  .ds_font td,span  { font: normal 12px 宋体; color: #000000; }");
  213.   document.write("  .ds_border  { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");
  214.   document.write("  .ds_border2  { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");
  215.   document.write("</style>");
  216.   document.write("<input style='width:72px;text-align:left;' class='textfield' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-"+this.date+"' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly>");
  217.   document.write("<button style='width:60px;height:18px;font-size:12px;margin:1px;border:1px solid #A4B3C8;background-color:#DFE7EF;' type=button onclick=this.nextSibling.style.display='block' onfocus=this.blur()>选择日期</button>");
  218.   document.write("<div style='position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible' onselectstart='return false;'>");
  219.   document.write("  <div style='position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid #245B7D;' class=ds_font>");
  220.   document.write("    <table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>");
  221.   document.write("      <tr align=center>");
  222.   document.write("        <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subYear(this) title='减小年份'>&lt;&lt;</td>");
  223.   document.write("        <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subMonth(this) title='减小月份'>&lt;</td>");
  224.   document.write("        <td width=52%><b>"+this.year+"</b><b>年</b><b>"+this.month+"</b><b>月</b></td>");
  225.   document.write("        <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addMonth(this) title='增加月份'>&gt;</td>");
  226.   document.write("        <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addYear(this) title='增加年份'>&gt;&gt;</td>");
  227.   document.write("      </tr>");
  228.   document.write("    </table>");
  229.   document.write("    <table cellpadding=0 cellspacing=0 width=140 height=20 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>");
  230.   document.write("      <tr align=center>");
  231.   for(i=0;i<7;i++)
  232. document.write("      <td>"+week[i]+"</td>");
  233.   document.write("      </tr>");
  234.   document.write("    </table>");
  235.   document.write("    <table cellpadding=0 cellspacing=2 width=140 bgcolor=#EEEEEE>");
  236.   for(i=0;i<6;i++)
  237.   {
  238.     document.write("    <tr align=center>");
  239. for(j=0;j<7;j++)
  240.       document.write("    <td width=10% height=16 onmouseover=if(this.innerText!=''&&this.className!='ds_border2')this.className='ds_border' onmouseout=if(this.className!='ds_border2')this.className='' onclick=getValue(this,document.all('DS_"+this.inputName+"'))></td>");
  241.     document.write("    </tr>");
  242.   }
  243.   document.write("    </table>");
  244.   document.write("    <span style=cursor:hand onclick=this.parentNode.parentNode.style.display='none'>【关闭】</span>");
  245.   document.write("  </div>");
  246.   document.write("</div>");
  247.   dateShow(document.all("DS_"+this.inputName).nextSibling.nextSibling.childNodes[0].childNodes[2],this.year,this.month)
  248. }
  249. function subYear(obj)  //减小年份
  250. {
  251.   var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
  252.   myObj[0].innerHTML=eval(myObj[0].innerHTML)-1;
  253.   dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
  254. }
  255. function addYear(obj)  //增加年份
  256. {
  257.   var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
  258.   myObj[0].innerHTML=eval(myObj[0].innerHTML)+1;
  259.   dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
  260. }
  261. function subMonth(obj)  //减小月份
  262. {
  263.   var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
  264.   var month=eval(myObj[2].innerHTML)-1;
  265.   if(month==0)
  266.   {
  267.     month=12;
  268.     subYear(obj);
  269.   }
  270.   myObj[2].innerHTML=month;
  271.   dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
  272. }
  273. function addMonth(obj)  //增加月份
  274. {
  275.   var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
  276.   var month=eval(myObj[2].innerHTML)+1;
  277.   if(month==13)
  278.   {
  279.     month=1;
  280.     addYear(obj);
  281.   }
  282.   myObj[2].innerHTML=month;
  283.   dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
  284. }
  285. function dateShow(obj,year,month)  //显示各月份的日
  286. {
  287.   var myDate=new Date(year,month-1,1);
  288.   var today=new Date();
  289.   var day=myDate.getDay();
  290.   var selectDate=obj.parentNode.parentNode.previousSibling.previousSibling.value.split('-');
  291.   var length;
  292.   switch(month)
  293.   {
  294.     case 1:
  295.     case 3:
  296.     case 5:
  297.     case 7:
  298.     case 8:
  299.     case 10:
  300.     case 12:
  301.       length=31;
  302.       break;
  303.     case 4:
  304.     case 6:
  305.     case 9:
  306.     case 11:
  307.       length=30;
  308.       break;
  309.     case 2:
  310.       if((year%4==0)&&(year%100!=0)||(year%400==0))
  311.         length=29;
  312.       else
  313.         length=28;
  314.   }
  315.   for(i=0;i<obj.cells.length;i++)
  316.   {
  317.     obj.cells[i].innerHTML='';
  318.     obj.cells[i].style.color='';
  319.     obj.cells[i].className='';
  320.   }
  321.   for(i=0;i<length;i++)
  322.   {
  323.     obj.cells[i+day].innerHTML=(i+1);
  324.     if(year==today.getFullYear()&&(month-1)==today.getMonth()&&(i+1)==today.getDate())
  325.       obj.cells[i+day].style.color='red';
  326.     if(year==eval(selectDate[0])&&month==eval(selectDate[1])&&(i+1)==eval(selectDate[2]))
  327.       obj.cells[i+day].className='ds_border2';
  328.   }
  329. }
  330. function getValue(obj,inputObj)  //把选择的日期传给输入框
  331. {
  332.   var myObj=inputObj.nextSibling.nextSibling.childNodes[0].childNodes[0].cells[2].childNodes;
  333.   if(obj.innerHTML)
  334.     inputObj.value=myObj[0].innerHTML+"-"+myObj[2].innerHTML+"-"+obj.innerHTML;
  335.   inputObj.nextSibling.nextSibling.style.display='none';
  336.   for(i=0;i<obj.parentNode.parentNode.parentNode.cells.length;i++)
  337.     obj.parentNode.parentNode.parentNode.cells[i].className='';
  338.   obj.className='ds_border2'
  339. }
  340. function dsMove(obj)  //实现层的拖移
  341. {
  342.   if(event.button==1)
  343.   {
  344.     var X=obj.clientLeft;
  345.     var Y=obj.clientTop;
  346.     obj.style.pixelLeft=X+(event.x-DS_x);
  347.     obj.style.pixelTop=Y+(event.y-DS_y);
  348.   }
  349. }