1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| var iMessageBox = function(msg, callbackOk, callbackCancel, dom){
var mask = document.createElement('div');
var pop = document.createElement('div');
var message = document.createElement('h4');
var ok = document.createElement('input');
ok.type = "button";
ok.value = "__MSG_ok__";
ok.__dom = dom;
ok.__func = callbackOk;
ok.__mask = mask;
ok.__pop = pop;
ok.onclick = function(){
if(this.__func)
this.__func.call(this.__dom);
document.body.removeChild(this.__mask);
document.body.removeChild(this.__pop);
}
message.innerHTML = msg;
var cancel = document.createElement('input');
cancel.type = "button";
cancel.value = '__MSG_cancel__';
cancel.__dom = dom;
cancel.__mask = mask;
cancel.__pop = pop;
cancel.__func = callbackCancel;
cancel.onclick = function(){
if(this.__func)
this.__func.call(this.__dom);
document.body.removeChild(this.__mask);
document.body.removeChild(this.__pop);
}
pop.appendChild(message);
pop.appendChild(ok);
pop.appendChild(cancel);
document.body.appendChild(mask);
document.body.appendChild(pop);
mask.style.cssText = 'position:absolute;background:#000;opacity:.3;width:100%;*filter: Alpha(Opacity=30);top:0;left:0';
mask.style.display = 'block';
mask.style.height = document.body.clientHeight +document.body.scrollTop+ 'px';
document.body.style.overflow = 'hidden';
pop.style.cssText = 'position:absolute;width:200;padding:8px;background:#fff;border:2px solid #000;text-align:center';
pop.style.display = 'block';
pop.style.left =document.body.offsetWidth / 2 - pop.offsetWidth / 2 + 'px';
pop.style.top = document.body.offsetHeight / 2 - pop.offsetHeight / 2 + 'px';
}
|