The announcement window may be blocked by some netassistant if it is used as a pop-up window! So I wrote an announcement Div's Js.
Demo address: http://blog.csdn.net/bgu/
CodeAs follows: (put it in the body area)
< Div ID = " Affiche " Ondblclick = " Closediv (); " Style = " Border-Right: Black 1px outset; border-top: Black 1px outset; border-left: Black 1px outset; width: 30%; clip: rect (Auto auto ); border-bottom: Black 1px outset; position: absolute; Height: 30%; Background-color: whitesmoke; text-align: center; " Align = " Center " >
< Table height = " 100% " Width = " 100% " >
< Tr >
< TD valign = " Middle " Align = " Center " Height = " 100% " >
Here is the announcement content
< Div ID = " Timeout " > </ Div >
</ TD >
</ Tr >
</ Table >
</ Div >
< Script Language = " Javascript " >
VaR Intout = 10 ;
Timediv ();
Function Closediv ()
{
Document. getelementbyid ( " Affiche " ). Style. Display = " None " ;
}
Function Timediv ()
{
-- Intout;
If (Random UT > 1 )
{
Window. setTimeout ( " Timediv () " , 1000 );
Document. getelementbyid ( " Timeout " ). Innertext = Intout + " Seconds later/double-click window to automatically close! " ;
}
Else
{
Closediv ();
}
}
VaR Objdiv = Document. getelementbyid ( " Affiche " );
Setdiv ();
Function Setdiv ()
{
Objdiv. style. Top = (Document. Body. offsetheight - Objdiv. offsetheight) / 2 + Document. Body. scrolltop;
Objdiv. style. Left = (Document. Body. offsetwidth - Objdiv. offsetwidth) / 2 ;
If(Random UT>1)
{
Window. setTimeout ( " Setdiv () " , 2 00 );
}
}
</ Script >