JqueryJsExtJs pop-up custom image display with layers

Source: Internet
Author: User
& Lt; style & gt; html, body {font-size: 12px; margin: 0px; height: 100% ;}. mesWindow {border: #6661 pxsolid; background: # fff ;}. mesWindowTop {border-bottom: # eee1pxsolid; margin-le

 

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 =" "

+ WTitle

+""

+ Content + "";

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 = "";

ShowMessageBox ('', messContent, objPos, 1550 );

}

Script

 

// The following code is written in the body to call the above method.

 

 

 

 

 

 

This article is from the "3345617" blog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.