<! Doctype HTML>
<HTML>
<Head>
<Meta charset = "UTF-8">
<Title> untitled document </title>
<Style>
* {Margin: 0; padding: 0}
# Box {width: 700px; margin: 0 auto ;}
# Box ul {width: 198px; float: Left; Border: 1px solid #000; margin-Right: 50px ;}
# Box ul Li {list-style: none; font-size: 100px; color: # FFF ;}
</Style>
<SCRIPT>
Function Test ()
{
VaR obox = Document. getelementbyid ('box ');
VaR aul = obox. Children;
VaR n = 0;
// 20 at a time
For (VAR I = 0; I <20; I ++)
{
Function RND (n, m)
{
Return parseint (math. Random () * (m-n + 1) + n );
};
VaR Oli = Document. createelement ('lil ');
N ++;
Oli. innerhtml = N;
Oli. style. Height = RND (100,400) + 'px ';
Oli. style. Background = 'rgb ('+ RND (0,255) +', '+ RND (0,255) +', '+ RND (0,255) + ')';
// Find the smallest ul
VaR oul;
If (aul [0]. offsetheight <aul [1]. offsetheight)
{
If (aul [0]. offsetheight <aul [2]. offsetheight)
{
Oul = aul [0];
}
Else
{
Oul = aul [2];
};
}
Else
{
If (aul [1]. offsetheight <aul [2]. offsetheight)
{
Oul = aul [1];
}
Else
{
Oul = aul [2];
};
};
Oul. appendchild (Oli );
};
}
Window. onload = function ()
{Test ();
}
// The scroll distance of the scroll bar on the Y axis
Function getscrolltop (){
VaR scrolltop = 0, bodyscrolltop = 0, documentscrolltop = 0;
If (document. Body ){
Bodyscrolltop = Document. Body. scrolltop;
}
If(document.doc umentelement ){
Documentscrolltop = document.doc umentelement. scrolltop;
}
Scrolltop = (bodyscrolltop-documentscrolltop> 0 )? Bodyscrolltop: documentscrolltop;
Return scrolltop;
}
// Document height
Function getscrollheight (){
VaR scrollheight = 0, bodyscrollheight = 0, documentscrollheight = 0;
If (document. Body ){
Bodyscrollheight = Document. Body. scrollheight;
}
If(document.doc umentelement ){
Documentscrollheight = document.doc umentelement. scrollheight;
}
Scrollheight = (bodyscrollheight-documentscrollheight> 0 )? Bodyscrollheight: documentscrollheight;
Return scrollheight;
}
// The height of the browser.
Function getwindowheight (){
VaR required wheight = 0;
If (document. compatmode = "css1compat "){
Required wheight = document.doc umentelement. clientheight;
} Else {
Optional wheight = Document. Body. clientheight;
}
Return optional wheight;
}
Window. onscroll = function (){
If (getscrolltop () + getwindowheight ()> = getscrollheight ()-300 ){
// Alert ("You are in the bottom! ");
Test ()
}
};
</SCRIPT>
</Head>
<Body>
<Div id = "box">
<Ul> </ul>
<Ul> </ul>
<Ul style = "margin: 0;"> </ul>
</Div>
<Div class = "footer" id = "BM">
</Body>
</Html>
Waterfall stream color Random Loading scroll