/[webpac]/trunk2/out/js/findpos.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk2/out/js/findpos.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 497 - (hide annotations)
Sun Oct 10 08:12:06 2004 UTC (19 years, 6 months ago) by dpavlin
File MIME type: application/javascript
File size: 499 byte(s)
scroll to anchor position on page as opposed to changing document.location
which reloads page in Opera

1 dpavlin 497 // written by Peter-Paul Koch
2     // http://www.quirksmode.org/home.html
3    
4    
5     function findPosX(obj) {
6     var curleft = 0;
7     if (obj.offsetParent) {
8     while (obj.offsetParent) {
9     curleft += obj.offsetLeft
10     obj = obj.offsetParent;
11     }
12     }
13     else if (obj.x)
14     curleft += obj.x;
15     return curleft;
16     }
17    
18     function findPosY(obj) {
19     var curtop = 0;
20     if (obj.offsetParent) {
21     while (obj.offsetParent) {
22     curtop += obj.offsetTop
23     obj = obj.offsetParent;
24     }
25     }
26     else if (obj.y)
27     curtop += obj.y;
28     return curtop;
29     }

  ViewVC Help
Powered by ViewVC 1.1.26