error.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. function v(id) {
  2. return document.getElementById(id);
  3. }
  4. // 显示
  5. function showErrorMsg(id) {
  6. var t = v(id);
  7. t.style.width = document.body.clientWidth + "px";
  8. t.style.height = document.body.clientHeight + "px";
  9. window.onresize = function() {
  10. t.style.width = document.body.clientWidth + "px";
  11. t.style.height = document.body.clientHeight + "px";
  12. }
  13. v(id).style.display = "";
  14. }
  15. // 关闭
  16. function closeWin(id) {
  17. v(id).style.display = "none";
  18. }
  19. //复制
  20. function copy(id) {
  21. v(id).select();
  22. var msg=v(id).value;
  23. window.clipboardData.setData('text', msg);
  24. alert('错误信息已成功复制到剪切板!');
  25. }
  26. //保存
  27. function save(id) {
  28. var msg=v(id).value;
  29. var fso = new ActiveXObject("Scripting.FileSystemObject");
  30. var tf = fso.createtextfile("c:\\系统异常信息.txt",true);
  31. // 填写数据,并增加换行符
  32. tf.WriteLine("系统异常信息:") ;
  33. tf.WriteLine("----------------------------------------------") ;
  34. // 增加2个空行
  35. tf.WriteBlankLines(2) ;
  36. // 填写一行,不带换行符
  37. tf.Write (msg);
  38. // 关闭文件
  39. tf.Close();
  40. alert('文件路径:C:\\系统异常信息.txt');
  41. }
  42. //返回
  43. function toBack(){
  44. window.history.go(-1);
  45. }
  46. //显示管理员信息
  47. function showAdminInfo(){
  48. showErrorMsg('adminInfo');
  49. }
  50. // -------------------------------------------------------------------------------
  51. function moveEvent(e, id) {
  52. var isIE = (document.all) ? true : false;
  53. // navigator.userAgent.toLowerCase().indexOf("msie") != -1;
  54. // var event=window.event||event;
  55. drag = true;
  56. xx = isIE ? event.x : e.pageX;
  57. yy = isIE ? event.y : e.pageY;
  58. L = v(id).offsetLeft;
  59. T = v(id).offsetTop;
  60. document.onmousemove = function(e) {
  61. if (drag) {
  62. x = isIE ? event.x : e.pageX;
  63. if (x < 0)
  64. x = 0;
  65. y = isIE ? event.y : e.pageY;
  66. if (y < 0)
  67. y = 0;
  68. v(id).style.left = L - xx + x;
  69. v(id).style.top = T - yy + y;
  70. }
  71. };
  72. document.onmouseup = function() {
  73. drag = false;
  74. };
  75. };
  76. // -------------------------------------------------------------------------------
  77. window.onscroll = function() {
  78. v("back_div").style.width = document.body.scrollWidth + "px";
  79. v("back_div").style.height = document.body.scrollHeight + "px";
  80. };