dialog.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * 窗口文件
  3. */
  4. if (typeof Dialog == 'undefined') {
  5. Dialog = {};
  6. }
  7. /**
  8. * 弹出模态窗口
  9. *
  10. * @param {}
  11. * conf
  12. */
  13. Dialog.showDialog = function(conf) {
  14. if (!conf)
  15. conf = {};
  16. var dialogWidth = 800, dialogHeight = 400;
  17. conf = $.extend({}, {
  18. dialogWidth : dialogWidth,
  19. dialogHeight : dialogHeight,
  20. help : 0,
  21. status : 0,
  22. scroll : 0,
  23. center : 1
  24. }, conf);
  25. // 作用域
  26. var scope = conf.scope ? conf.scope : this,
  27. winArgs = "dialogWidth="
  28. + conf.dialogWidth + "px;dialogHeight=" + conf.dialogHeight
  29. + "px;help=" + conf.help + ";status=" + conf.status + ";scroll="
  30. + conf.scroll + ";center=" + conf.center,
  31. url = conf.url.getNewUrl();
  32. /*var rtn = window.showModalDialog(url, window, winArgs);
  33. if (conf.callback) {
  34. conf.callback.call(scope, rtn);
  35. }*/
  36. /*KILLDIALOG*/
  37. DialogUtil.open({
  38. height:conf.dialogHeight,
  39. width: conf.dialogWidth,
  40. title : '弹出模态窗口',
  41. url: url,
  42. isResize: true,
  43. //自定义参数
  44. window: window,
  45. sucCall:function(rtn){
  46. conf.callback.call(scope, rtn);
  47. }
  48. });
  49. };
  50. /**
  51. * 模态窗口高度调整. 根据操作系统及ie不同版本,重新设置窗口高度,避免滚动条出现.
  52. */
  53. Dialog.resetDialogHeight = function resetDialogHeight(height) {
  54. var ua = navigator.userAgent;
  55. if (ua.lastIndexOf("MSIE 6.0") != -1) {
  56. if (ua.lastIndexOf("Windows NT 5.1") != -1) {
  57. // alert("xp.ie6.0");
  58. return (height + 102);
  59. } else if (ua.lastIndexOf("Windows NT 5.0") != -1) {
  60. // alert("w2k.ie6.0");
  61. return (height + 49);
  62. }
  63. }
  64. };