<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml" lang = "gb2312">
<Head> <title> pop-up window </title>
<LINK rel = "stylesheet" href = "css.css" type = "text/CSS" Media = "all"/>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Meta name = "Robots" content = "all"/>
<Meta name = "author" content = "kinsunhoo (AT) yahoo.com.cn"/>
<Style type = "text/CSS">
<! --
Body {
Margin: 0px 0px 0px 0px;
Padding: 0px 0px 0px 0px;
Font-family: verdana, Arial, Helvetica, sans-serif ,??;
Color: #060;
Background-color: # cccccc;
Font-size: 12px;
Line-Height: 22px;
}
# Corner_tips
{
Z-index: 105;
Width: 300px;
Padding: 10px;
Margin-Right: 0px;
/* Opera does not like 'margin: 20px auto '*/
Background: # FFF;
Border: 5px solid #666;
Text-align: center;
/* Part 2 of 2 centering hack */
Width: 300px;/* ie5win fudge begins */
Voice-family :"/"}/"";
Voice-family: Inherit;
Width: 270px;
}
// -->
</Style>
<Script language = "JavaScript" type = "text/JavaScript">
<! --
Function hide_div (ID)
{
VaR div_obj = Document. getelementbyid (ID );
If (div_obj! = NULL)
{
Div_obj.style.display = "NONE ";
Div_obj.removenode (true );
Return false;
}
}
Function create_tips (ID, text)
{
Ele = Document. createelement ("Div ");
Ele. setattribute ("ID", ID );
Document. Body. appendchild (Ele );
Ele. innerhtml = text;
}
VaR pop;
VaR temp_h = 0 ;//
VaR BC = 5; // the lower right pop-up step
VaR holdtime = 10; // The retention time (in seconds) after the window is fully expanded in the lower right corner.
VaR kpspeed = 20; // keepposition () is executed once in 20 milliseconds
VaR poptext = "<p> Hello, world! <Br/> note: this prompt will automatically disappear after "+ holdtime +" seconds after it is fully expanded <br/> content of the highly adaptive prompt in this box </P> ";
VaR ktimer;
Function poping (P)
{
VaR ele = Document. getelementbyid ("corner_tips ");
Pop = P;
If (POP = "close ")
{
VaR tips_h = ELE. offsetheight;
Holdtime =-1;
Temp_h = tips_H-bc;
Ele. innerhtml = "<span> closing... </span>" + poptext;
Cleartimeout (ktimer );
}
Else
{
Create_tips ("corner_tips", "<span> opening... </span>" + poptext );
}
Popingup ();
}
Function popingup ()
{
VaR ele = Document. getelementbyid ("corner_tips ");
VaR tips_w = ELE. offsetwidth;
VaR tips_h = ELE. offsetheight;
VaR tips_x=document.doc umentelement. clientWidth-tips_W;
VaR tips_y=document.documentelement.clientheight?document.doc umentelement. scrollTop-temp_h; // scroll wheel Variation
If (temp_h <= tips_h)
{
Ele. style. Height = temp_h;
Ele.style.css text = "position: absolute; top:" + tips_y + "PX; left:" + tips_x + "PX ;";
Temp_h = temp_h + BC;
VaR puptime = setTimeout ("popingup ()", 20 );
}
Else
{
// Completely expand
Cleartimeout (puptime );
// Alert ("Skip popingup ()");
TEXT = "<p> <a href =/" javascript:;/"onclick =/" closedown (); /"> close the pop-up window </a> </P> ";
Ele. innerhtml = text + poptext;
Keepposition ();
}
}
Function keepposition ()
{
VaR ele = Document. getelementbyid ("corner_tips ");
If (Ele! = NULL)
{
If (holdtime> 0)
{
// Float after opening
VaR tips_w = ELE. offsetwidth;
VaR tips_h = ELE. offsetheight;
VaR tips_x=document.doc umentelement. clientWidth-tips_W;
VaR tips_y=document.documentelement.clientheight?document.doc umentelement. scrollTop-tips_H; // scroll wheel Variation
Ele.style.css text = "position: absolute; top:" + tips_y + "PX; left:" + tips_x + "PX ;";
Holdtime = holdtime-kpspeed/1000;
Ktimer = setTimeout ("keepposition ()", kpspeed );
}
Else
{
Cleartimeout (ktimer );
Ele. innerhtml = "<span> closing... </span>" + poptext;
// Alert ("Skipping keepposition ()");
Popingdown ();
}
}
}
Function popingdown ()
{
VaR ele = Document. getelementbyid ("corner_tips ");
If (Ele! = NULL)
{
VaR tips_w = ELE. offsetwidth;
VaR tips_h = ELE. offsetheight;
VaR tips_x=document.doc umentelement. clientWidth-tips_W;
VaR tips_y=document.documentelement.clientheight?document.doc umentelement. scrollTop-temp_h; // scroll wheel Variation
If (temp_h> 0)
{
Ele. style. Height = temp_h;
Ele.style.css text = "position: absolute; top:" + tips_y + "PX; left:" + tips_x + "PX ;";
Temp_h = temp_h-bc;
VaR pdowntime = setTimeout ("popingdown ()", 20 );
}
Else
{
// Scale back
Cleartimeout (pdowntime );
Hide_div ("corner_tips ");
Return false;
}
}
}
Function closedown ()
{
Poping ("close ");
}
// -->
</SCRIPT>
</Head>
<Body onload = "poping ();">
<Div align = "center">
<P> d </P> <p> d </P>
<P> d </P> <p> d </P>
</Div>
</Body>
</Html>