<Style>
Html, body {
Font-size: 12px;
Margin: 0px;
Height: 100%;
}
. MesWindow {
Border: #666 1px solid;
Background: # fff;
}
. MesWindowTop {
Border-bottom: # eee 1px solid;
Margin-left: 4px;
Padding: 3px;
Font-weight: bold;
Text-align: left;
Font-size: 12px;
}
. MesWindowContent {
Margin: 4px;
Font-size: 12px;
}
. MesWindow. close {
Height: 15px;
Width: 28px;
Border: none;
Cursor: pointer;
Text-decoration: underline;
Background: # fff
}
</Style>
<Script>
Var isIe = (document. all )? True: false;
// Set the visible status of select
Function setSelectState (state ){
Var objl = document. getElementsByTagName ('select ');
For (var I = 0; I <objl. length; I ++ ){
Objl [I]. style. visibility = state;
}
}
Function mousePosition (ev ){
If (ev. pageX | ev. pageY ){
Return {
X: ev. pageX,
Y: ev. pageY
};
}
Return {
X: ev. clientX + document. body. scrollLeft
-Document. body. clientLeft,
Y: ev. clientY + document. body. scrollTop-document. body. clientTop
};
}
// Pop-up method
Function showMessageBox (wTitle, content, pos, wWidth ){
CloseWindow ();
Var bWidth = parseInt(document.doc umentElement. scrollWidth );
Var bHeight = parseInt(document.doc umentElement. scrollHeight );
If (isIe ){
SetSelectState ('den den ');
}
Var back = document. createElement ("div ");
Back. id = "back ";
Var styleStr = "top: 0px; left: 0px; position: absolute; background: #666; width :"
+ BWidth + "px; height:" + bHeight + "px ;";
StyleStr + = (isIe )? "Filter: alpha (opacity = 0);": "opacity: 0 ;";
Back.style.css Text = styleStr;
Document. body. appendChild (back );
ShowBackground (back, 50 );
Var mesW = document. createElement ("div ");
MesW. id = "mesWindow ";
MesW. className = "mesWindow ";
MesW. innerHTML = "<div class = 'meswindowtop '> <table width = '000000' height = '000000'> <tr> <td>"
+ WTitle
+ "</Td> <td style = 'width: 1px; '> <input type = 'button 'title = 'close Windows' class = 'close' value = 'close'/> </td> </tr> </table> </div> <div class = 'meswindowcontent' id = 'meswindowcontent'>"
+ Content + "</div> <div class = 'meswindowbottom '> </div> ";
StyleStr = "left: 0px; top: 25px; position: absolute ;";
MesW.style.css Text = styleStr;
Document. body. appendChild (mesW );
}
// Gradually darken the background
Function showBackground (obj, endInt ){
If (isIe ){
Obj. filters. alpha. opacity + = 1;
If (obj. filters. alpha. opacity <endInt ){
SetTimeout (function (){
ShowBackground (obj, endInt)
}, 5 );
}
} Else {
Var al = parseFloat (obj. style. opacity );
Al ++ = 0.01;
Obj. style. opacity = al;
If (al <(endInt/100 )){
SetTimeout (function () {www.2cto.com
ShowBackground (obj, endInt)
}, 5 );
}
}
}
// Close the window
Function closeWindow (){
If (document. getElementById ('back ')! = Null ){
Document. getElementById ('back'). parentNode. removeChild (document
. GetElementById ('back '));
}
If (document. getElementById ('meswindow ')! = Null ){
Document. getElementById ('meswindow'). parentNode
. RemoveChild (document. getElementById ('meswindow '));
}
If (isIe ){
SetSelectState ('');
}
}
// Test the pop-up
Function testMessageBox (ev ){
Var objPos = mousePosition (ev );
MessContent = "<div> </div> ";
ShowMessageBox ('', messContent, objPos, 1550 );
}
</Script>
// The following code is written in the body to call the above method.
<A href = "# none" src = "images/Simulation_46.gif"/> </a>
This article is from the "3345617" blog