日期:2014-05-16 浏览次数:20474 次
/* JavaScript Document */ /* 页面MASK的对象ID */ var PAGE_MASK_ID = "page-mask-id"; /* 页面MASK对象的样式类名 */ var MASK_CLASS_NAME = "dlg-mask"; /* 页面UNMASK对象的样式类名 */ var UNMASK_CLASS_NAME = "dlg-unmask"; /* 页面对话框对象显示的样式类名 */ var DIALOG_CLASS_SHOW = "dialog-show"; /* 页面对话框对象隐藏的样式类名 */ var DIALOG_CLASS_HIDE = "dialog-hide"; var PAGE_IFRAME_MASK = "parge-iframe-for-mask-dialog"; var titleText = "提示"; var okText = "确定"; var cancelText = "取消"; /** * * @param id id * @param contentText 提示内容 * @param promptCallback 点击确定时绑定的函数 */ function showDialogs (id, contentText, promptCallback) { createDialog(id, contentText, promptCallback); appshowDialog(id, 300); }; function removeChildNodes(dialog) { var childs = dialog.childNodes; for ( var i = childs.length - 1; i >= 0; i--) { dialog.removeChild(childs[i]); } } function createDialog(id, contentText, promptCallback) { var dialog = document.getElementById(id);// dialog if (!dialog) { dialog = document.createElement("div"); dialog.id = id; } removeChildNodes(dialog); dialog.className = DIALOG_CLASS_SHOW; var u1 = document.createElement("U"); u1.className = "f1"; var u2 = document.createElement("U"); u2.className = "f2"; var u3 = document.createElement("U"); u3.className = "f3"; dialog.appendChild(u1); dialog.appendChild(u2); dialog.appendChild(u3); var titleDiv = document.createElement("div"); titleDiv.className = "d_top"; dialog.appendChild(titleDiv); var titleName = document.createElement("span"); titleName.innerHTML = titleText; titleDiv.appendChild(titleName); var imageherf = document.createElement("a"); imageherf.href = "javascript:void(0);"; var imageClose = document.createElement("img"); imageClose.src = "/rts/images/pupsnow_003.gif"; imageClose.border = "0"; imageherf.appendChild(imageClose); titleDiv.appendChild(imageherf); var content = document.createElement("div"); content.className = "d_body"; var promptImage = document.createElement("img"); promptImage.src = "/rts/images/!.png"; promptImage.border = "0"; promptImage.align = "absmiddle"; content.appendChild(promptImage); content.appendChild(document.createTextNode(contentText)); content.appendChild(document.createElement("br")); content.appendChild(document.createElement("br")); dialog.appendChild(content); var center = document.createElement("div"); center.align = "center"; content.appendChild(center); var okButton = document.createElement("input"); okButton.type = "button"; okButton.className = "alert-okButton"; okButton.value = okText; center.appendChild(okButton); var cancelButton = document.createElement("input"); cancelButton.type = "button"; cancelButton.className = "alert-cancelButton"; cancelButton.value = cancelText; center.appendChild(cancelButton); var foot = document.createElement("div"); foot.className = "d_foot"; dialog.appendChild(foot); var u4 = document.createElement("U"); u1.className = "f1"; var u5 = document.createElement("U"); u2.className = "f2"; var u6 = document.createElement("U"); u3.className = "f3"; dialog.appendChild(u6); dialog.appendChild(u5); dialog.appendChild(u4); document.body.appendChild(dialog); okFunction = function() { cancel(id); if (promptCallback) promptCallback(id); }; cancelFunction = function hideDialog() { cancel(id); }; imageherf.onclick = cancelFunction; okButton.onclick = okFunction; cancelButton.onclick = cancelFunction; appshowDialog(id, 300); } function appshowDialog(dialog, width) { if ((typeof dialog) == "string") { dialog = document.getElementById(dialog); } if (!dialog) { return; } dialogMask(); /* 改变样式 */ dialog.className = DIALOG_CLASS_SHOW; dialog.style.display = ''; dialog.style.width = width + "px"; // dialog.style.height = height + "px"; /* 可拖动 */ // drag(dialog); /* 调整位置至居中 */ center(dialog, width); if (navigator.appName == 'Microsoft Internet Explorer') { var mif = document.getElementById(