CopyCode Code: var STR = "Customer Service ";
VaR objft = new floatt ("floatmenu1", STR, 942,137,125,200 );
Objft. floatrun ();
// JS scroll with the scroll bar
// Pobjname: HTML element ID
// Ptext: HTML Element Content
// Others
Function floatt (pobjname, ptext, pstmnleft, pstmngap1, pstmngap2, pstmnbase, pstmnactivatespeed, pstmnscrollspeed)
{
VaR floatmenu;
VaR stmnleft = pstmnleft;
VaR stmngap1 = pstmngap1;
VaR stmngap2 = pstmngap2;
VaR stmnbase = pstmnbase;
VaR stmnactivatespeed = pstmnactivatespeed;
VaR stmnscrollspeed = pstmnscrollspeed;
This. floatrun = function (pobjname)
{
VaR newdiv = Document. createelement ("Div ");
Newdiv. ID = pobjname;
Newdiv. innerhtml = ptext;
Newdiv. style. Position = "absolute ";
Document. Body. appendchild (newdiv );
Floatmenu = Document. getelementbyid (pobjname );
Floatmenu. style. Display = "";
Floatmenu. style. Top = document.doc umentelement. scrolltop + stmnbase + "PX ";
Floatmenu. style. Left = stmnleft + "PX ";
Refreshstaticmenu ();
}
Refreshstaticmenu = function ()
{
VaR stmnstartpoint, stmnendpoint, stmnrefreshtimer;
Stmnstartpoint = parseint (floatmenu. style. Top, 10 );
Stmnendpoint = document.doc umentelement. scrolltop + stmngap2;
If (stmnendpoint <stmngap1) stmnendpoint = stmngap1;
If (stmnstartpoint! = Stmnendpoint)
{< br> stmnscrollamount = math. ceil (math. ABS (stmnendpoint-stmnstartpoint)/15);
floatmenu. style. top = parseint (floatmenu. style. top, 10) + (stmnendpoint stmnrefreshtimer = stmnscrollspeed;
}< br> else
{< br> stmnrefreshtimer = stmnactivatespeed;
}< br> setTimeout ("refreshstaticmenu ();", stmnrefreshtimer);
}< BR >}