Used to load the mask on an existing window and embed other page content in the mask
The Code is as follows:
// Initialize the navigation background, iframe container
Function fnDaoHangBg ()
{
Var h = fnGetHeight (), w = fnGetWidth (); // obtain the background window size.
If (! $ ('Pdaohangbg '))
{
Var p = $ C ('P'); // creates a background mask.
P. id = 'pdaohangbg ';
P. style. backgroundColor = 'black ';
P. style. position = 'absolute ';
P. style. filter = 'Alpha (opacity = 80 )';
P. style. opacity = '. 80 ';
P. style. zIndex = 100001;
P. style. left = 0;
P. style. top = 0;
P. style. width = w + 'px ';
P. style. height = h + 'px ';
Document. body. appendChild (p );
}
If (! $ ('Pdaohangbgiframe '))
{
Var iframe;
Iframe = this. $ C ('iframe'); // create an embedded IFRAME container in the mask for embedding and displaying other webpages
Iframe. id = 'pdaohangbgiframe ';
Iframe. frameBorder = '0 ';
Iframe. scrolling = "no ";
Iframe. style. overflow = 'ddd ';
Iframe. allowTransparency = 'true ';
Iframe. style. display = 'none ';
Iframe. style. width = w + 'px '; // 800
Iframe. style. height = h + 'px '; // 620
Iframe. style. marginTop = '75px '; // 800
$ ('Pdaohangbg '). appendChild (iframe );
}
If (! $ ('Pdaohangbgclose '))
{
Var p = $ C ('P'); // create the close button on the mask.
P. id = 'pdaohangbgclose ';
P. style. position = 'absolute ';
P. style. backgroundImage = 'url (images/closb.gif )';
P. style. zIndex = 100003;
P. style. right = 10;
P. style. top = 20;
P. style. width = '82px ';
P. style. height = '30px ';
P. title = 'close ';
P. style. cursor = 'hand ';
P. onclick = function () {// click Time to close the mask.
FnDaoHangBgClose ();
};
$ ('Pdaohangbg '). appendChild (p );
}
$ ('Pdaohangbgiframe'). style. display = 'block ';
$ ('Pdaohangbg '). style. display = 'block ';
}
// Close the mask
Function fnDaoHangBgClose ()
{
If (! $ ('Pdaohangbg ') {return ;}
If (! $ ('Pdaohangbgiframe') {return ;}
$ ('Pdaohangbgiframe'). src = '';
$ ('Pdaohangbgiframe'). style. display = 'none ';
$ ('Pdaohangbg '). style. display = 'none ';
}
// Call, embedded url
Function fnDaoHangBgShow (url)
{
FnDaoHangBg ();
$ ('Pdaohangbgiframe'). src = url;
}
$ () And $ C () represent
$ (Id), the object for obtaining this id, document. getElementById (id)
$ C (tag), create a tag, document. createElement (tag );