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
|
function initMsgBox(){
var msgBox = document.createElement('div');
msgBox.id = 'msgBox';
msgBox.style.display = 'none';
var header = document.createElement('div');
header.className = 'header';
header.id = 'msgBoxHandle';
var btnClose = document.createElement('div');
btnClose.className = 'close';
btnClose.onmouseover = function(){
this.style.backgroundPosition = 'bottom left';
}
btnClose.onmouseout = function(){
this.style.backgroundPosition = 'top left';
}
btnClose.onclick = function(){
closeMsgBox();
}
var content = document.createElement('div');
content.id = 'msgBoxContent';
var zoneBtn = document.createElement('div');
zoneBtn.className = 'msgBoxZoneBtn';
var btn = document.createElement('input');
btn.type = 'button';
btn.value = '';
btn.onclick = function(){
closeMsgBox();
}
var footer = document.createElement('div');
footer.className = 'footer';
var pN = $A(document.getElementsByTagName('body'))[0];
msgBox.appendChild(header);
header.appendChild(btnClose);
msgBox.appendChild(content);
zoneBtn.appendChild(btn);
msgBox.appendChild(zoneBtn);
msgBox.appendChild(footer);
pN.appendChild(msgBox);
new Draggable('msgBox', {revert:false, starteffect:false, endeffect:false, handle:'msgBoxHandle'});
Event.observe(document, 'keypress', handleKeyPress);
window.alert = function(msg){
showMsgBox(msg);
}
} |
Partager