Revision: 58716
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 30, 2012 17:08 by maceblue
Initial Code
function message(text, bol_error) { var theBody = document.getElementsByTagName("body")[0]; var theNode = document.createElement('div'); var left = (screen.width/2)-250; var top = (screen.height/2); theNode.style.position = 'absolute'; theNode.style.top = top+'px'; theNode.style.left = left+'px'; theNode.style.width = '300px'; theNode.style.padding = '50px'; theNode.style.textAlign = 'center'; theNode.style.borderRadius = '1em'; theNode.style.MozBorderRadius = '1em'; theNode.style.fontSize = 'medium'; theNode.style.opacity = 0.0; theNode.style.MozOpacity = 0.0; theNode.style.KhtmlOpacity = 0.0; theNode.style.filter = "alpha(opacity=100)"; theNode.style.backgroundColor = (bol_error)? "#FFA1A1":"#F5F5F5"; theNode.style.backgroundImage = 'url('+mxClient.imageBasePath+'/messagebox_warning.png)'; theNode.style.backgroundPosition = '5px 5px'; theNode.style.backgroundRepeat = 'no-repeat'; theNode.style.border = '2px dashed #A6A6A6'; theNode.style.display = "block"; theNode.style.zIndex = '100'; theNode.innerHTML = text; theBody.appendChild(theNode); fade('in',theNode,1000); setTimeout( function(){fade("out",theNode,2000)}, 3000); setTimeout( function(){theBody.removeChild(theNode)}, 6000); } function fade(direction, elem, time) { if (typeof elem == 'undefined') return; (function go() { if(direction == 'in') { elem.style.opacity = parseFloat(elem.style.opacity)+0.1/time*1000; elem.style.MozOpacity = parseFloat(elem.style.opacity)+0.1/time*1000; elem.style.KhtmlOpacity = parseFloat(elem.style.opacity)+0.1/time*1000; // for IE elem.style.filter = 'alpha(opacity=' + elem.style.opacity * 100 + ')'; if( elem.style.opacity < 1 ) { setTimeout( go, 100 ); } else return; } else { elem.style.opacity = parseFloat(elem.style.opacity)-0.1/time*1000; elem.style.MozOpacity = parseFloat(elem.style.opacity)-0.1/time*1000; elem.style.KhtmlOpacity = parseFloat(elem.style.opacity)-0.1/time*1000; // for IE elem.style.filter = 'alpha(opacity=' + elem.style.opacity * 100 + ')'; if( elem.style.opacity > 0 ) { setTimeout( go, 100 ); } else return; } })(); }
Initial URL
Initial Description
shows a messagebox (better alert) with fade effekt
Initial Title
message fade-in/out
Initial Tags
Initial Language
JavaScript