Question: http://topic.csdn.net/u/20081218/10/9b08d8f4-e2cc-4aff-93d9-fd57625cf568.html
Download this one.
Http://topic.csdn.net/u/ui/scripts/Csdn/Forum/UserOnline1.js
- <A href = "http://hi.csdn.net/jxyxhz" target = "_ blank" Title = "enter user personal space"> </a>
- <HTML xmlns = "http://www.w3.org/1999/xhtml">
- <Head>
- <Title> No title page </title>
- <SCRIPT type = "text/JavaScript">
- // Display Div
- Function outw (o)
- {
- VaR left, top;
- VaR OBJ = Document. getelementbyid ("out ")
- OBJ. style. Display = "Block ";
- VaR z = getxy (o); // here is an array.
- // The following function is to calculate the position of the display layer and determine based on the scroll bar.
- VaR H = obj. style. Height. Replace ('px ','');
- If (Z [1]-getlt (). Top)> H)
- {
- Top = Z [1]-H + 'px ';
- }
- Else
- {
- Top = Z [1] + 'px ';
- }
- VaR W = obj. style. Width. Replace ('px ','');
- VaR r = Document. Body. clientwidth-getlt (). Left-w-Z [0];
- // Alert (document. Body. clientwidth + 'Eee '+ getlt (). Left + 'ddd' + W + 'ccc '+ Z [0]);
- If (r> W)
- {
- Left = Z [0] + Z [2] + 'px ';
- }
- Else
- {
- Left = Z [0]-W + 'px ';
- }
- OBJ. style. Top = top;
- OBJ. style. Left = left;
- }
- // Get the scroll bar and pass away
- Function getlt ()
- {
- VaR top, left;
- Top=document.doc umentelement. scrolltop;
- Left+document.doc umentelement. scrollleft;
- Return {top: Top, left: Left}; // call method: getlt (). Top
- }
- // Obtain coordinates
- Function getxy (E)
- {
- L = E. offsetleft;
- T = E. offsettop;
- R = E. offsetright;
- B = E. offsetbottom;
- W = E. offsetwidth;
- H = E. offsetheight;
- While (EE = E. offsetparent) // cyclically calculates all parent layers and obtains the correct coordinates.
- {L + = E. offsetleft; t + = E. offsettop ;}
- Return [L, t, W, H] // returns an array.
- }
- // Hide
- Function fhidden (o)
- {
- Document. getelementbyid ("out"). style. Display = "NONE ";
- }
- </SCRIPT>
- </Head>
- <Body>
- <Div style = "height: 120px; width: 250px; text-align: center; position: absolute; left: 20px; top: 20px; display: none; Background: blue; "id =" out ">
- </Div>
- <Div style = "overflow: auto; width: 300px;">
- Learn JS
- <A href = "#" onmouseover = "outw (this)" onmouseout = "fhidden (this)"> technical features </a>
- Learn JS
- </Div>
- </Body>
- </Html>