SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting Cell Position?

    Simple Question...

    Can you get the absolute position of a Cell in a table?


    and do you know a site that has the properties/methods of different objects in JS? (HTML objects really)

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting Cell Position?

    Originally posted by Wilco
    Simple Question...

    Can you get the absolute position of a Cell in a table?

    and do you know a site that has the properties/methods of different objects in JS? (HTML objects really)
    Yes!
    MSDN - The best of it's kind, but only contains that which IE supports
    Gecko DOM Reference - Not as comprehensive as MSDN, but the best DOM compatible reference that I know of.

    Now, about your question. In IE, you can just access the object.clientLeft and object.clientTop properties. In Gecko browsers, you will need a function that adds up all of the offsetLeft and/or offsetTop values between the TD element and it's respective parents.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i knew i hated JS, i just never found out why until now

    Code:
    <script language="javascript">
    <!--
    
       var is_gecko = (agt.indexOf('gecko') != -1);
    
    function echo_offset(ob)
    {
    	var total;
    	if (is_gecko)
    	{
    		
    		while(ob.name != "document")
    		{
    			total += ob.offsetleft;
    			var thisob = ob;
    			delete ob;
    			var ob = thisob.parent;
    		}
    		alert(total);
    	}
    	else
    	{
    		alert(ob.clientleft);
    	}
    }
    
    </script>
    using
    <td class="clan_links" onMouseOver="this.className='clan_links_mover';echo_offset(this);" onMouseOut="this.className='clan_links';">

    alerts "undefined"
    Last edited by Wilco; Oct 7, 2002 at 10:46.

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mozilla is an open-sourced web browser upon which several browsers are based. Mozilla currently uses Gecko for it's rendering engine

    www.mozilla.org
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    eek edited post, see up


    ignore, sorted, stupid fing stupid Capital letter scheme


    just in case your lost from what ive posted, ive sorted it
    Last edited by Wilco; Oct 7, 2002 at 10:54.

  6. #6
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh, good
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •