国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
4.6KB

  1. /**
  2. *
  3. * @version $Id: dialog.js 1 22:28 2010年7月20日Z tianya $
  4. * @package DedeBIZ.Administrator
  5. * @copyright Copyright (c) 2020, DedeBIZ.COM
  6. * @license https://www.dedebiz.com/license
  7. * @link https://www.dedebiz.com
  8. */
  9. document.write("<style type=\"text/css\">.close{float:right;cursor:default;}</style>")
  10. function editTitle(aid) {
  11. var show = document.getElementById("show_news");
  12. var myajax = new DedeAjax(show, false, false, "", "", "");
  13. myajax.SendGet2("catalog_edit.php?dopost=time&id=" + aid);
  14. DedeXHTTP = null;
  15. }
  16. function $Dede(id) { return document.getElementById(id) }
  17. function AlertMsg(title, id) {
  18. var msgw, msgh, msgbg, msgcolor, bordercolor, titlecolor, titlebg, content;
  19. //弹出窗口设置
  20. msgw = 600; //窗口宽度
  21. msgh = 400; //窗口高度
  22. msgbg = "#FFF"; //内容背景
  23. msgcolor = "#000"; //内容颜色
  24. bordercolor = "#5A6D58"; //边框颜色
  25. titlecolor = "#254015"; //标题颜色
  26. titlebg = "#369 url(images/tbg.gif)"; //标题背景
  27. //遮罩背景设置
  28. content = "<div id=show_news>对不起,载入失败</div>";
  29. var sWidth, sHeight;
  30. sWidth = screen.availWidth;
  31. if (screen.availHeight > document.body.scrollHeight) {
  32. sHeight = screen.availHeight; //少于一屏
  33. } else {
  34. sHeight = document.body.scrollHeight; //多于一屏
  35. }
  36. //创建遮罩背景
  37. var maskObj = document.createElement("div");
  38. maskObj.setAttribute('id', 'maskdiv');
  39. maskObj.style.position = "absolute";
  40. maskObj.style.top = "0";
  41. maskObj.style.left = "0";
  42. maskObj.style.background = "#777";
  43. maskObj.style.filter = "Alpha(opacity=30);";
  44. maskObj.style.opacity = "0.3";
  45. maskObj.style.width = sWidth + "px";
  46. maskObj.style.height = sHeight + "px";
  47. maskObj.style.zIndex = "10000";
  48. document.body.appendChild(maskObj);
  49. //创建弹出窗口
  50. var msgObj = document.createElement("div")
  51. msgObj.setAttribute("id", "msgdiv");
  52. msgObj.style.position = "absolute";
  53. //msgObj.style.top = (screen.availHeight - msgh) / 4 + "px";
  54. //msgObj.style.left = (screen.availWidth - msgw) / 2 + "px";
  55. msgObj.style.top = "100px";
  56. msgObj.style.left = "100px";
  57. msgObj.style.width = msgw + "px";
  58. msgObj.style.height = msgh + "px";
  59. msgObj.style.fontSize = "12px";
  60. msgObj.style.background = msgbg;
  61. msgObj.style.border = "1px solid " + bordercolor;
  62. msgObj.style.zIndex = "10001";
  63. //创建标题
  64. var thObj = document.createElement("div");
  65. thObj.setAttribute("id", "msgth");
  66. thObj.className = "DragAble";
  67. thObj.title = "按住鼠标左键可以拖动窗口!";
  68. thObj.style.cursor = "move";
  69. thObj.style.padding = "4px 6px";
  70. thObj.style.color = titlecolor;
  71. thObj.style.fontWeight = 'bold';
  72. thObj.style.background = titlebg;
  73. var titleStr = "<a class='close' title='关闭' style='cursor:pointer' onclick='CloseMsg()'>关闭</a>" + "<span>" + title + "</span>";
  74. thObj.innerHTML = titleStr;
  75. //创建内容
  76. var bodyObj = document.createElement("div");
  77. bodyObj.setAttribute("id", "msgbody");
  78. bodyObj.style.padding = "0px";
  79. bodyObj.style.lineHeight = "1.5em";
  80. var txt = document.createTextNode(content);
  81. bodyObj.appendChild(txt);
  82. bodyObj.innerHTML = content;
  83. //生成窗口
  84. document.body.appendChild(msgObj);
  85. $Dede("msgdiv").appendChild(thObj);
  86. $Dede("msgdiv").appendChild(bodyObj);
  87. editTitle(id);
  88. }
  89. function CloseMsg() {
  90. //移除对象
  91. document.body.removeChild($Dede("maskdiv"));
  92. $Dede("msgdiv").removeChild($Dede("msgth"));
  93. $Dede("msgdiv").removeChild($Dede("msgbody"));
  94. document.body.removeChild($Dede("msgdiv"));
  95. }
  96. //拖动窗口
  97. var ie = document.all;
  98. var nn6 = document.getElementById && !document.all;
  99. var isdrag = false;
  100. var y, x;
  101. var oDragObj;
  102. function moveMouse(e) {
  103. if (isdrag) {
  104. oDragObj.style.top = (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y) + "px";
  105. oDragObj.style.left = (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x) + "px";
  106. return false;
  107. }
  108. }
  109. function initDrag(e) {
  110. var oDragHandle = nn6 ? e.target : event.srcElement;
  111. var topElement = "HTML";
  112. while (oDragHandle.tagName != topElement && oDragHandle.className != "DragAble") {
  113. oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement;
  114. }
  115. if (oDragHandle.className == "DragAble") {
  116. isdrag = true;
  117. oDragObj = oDragHandle.parentNode;
  118. nTY = parseInt(oDragObj.style.top);
  119. y = nn6 ? e.clientY : event.clientY;
  120. nTX = parseInt(oDragObj.style.left);
  121. x = nn6 ? e.clientX : event.clientX;
  122. document.onmousemove = moveMouse;
  123. return false;
  124. }
  125. }
  126. document.onmousedown = initDrag;
  127. document.onmouseup = new Function("isdrag=false");