Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14

Thread: td and onClick

  1. #1
    New Coder
    Join Date
    Mar 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    td and onClick

    I am dynamically writing out a table and the cells are defined to be 'linked' when clicked as follows:

    strHTML += ' <td align="left" width=20 nowrap bgcolor="#000000" class="linksmenu" ' +
    ((nMenuItemStart > 0) ?
    'onmouseover="this.style.background=\'#003366\';menuDescription.innerHTML=\'more menu options...\';" ' +
    'onmouseout="this.style.background=\'#000000\';menuDescription.innerHTML=\'' + menuDescriptionDefault + '\'" ' +
    'onclick="SetCookie(\'MenuItemStart\', ' + (nMenuItemStart - 1) + '); DisplayMenuItems();" style="CURSOR: hand"> ' : '') +
    // '<span style="filter:glow(color=#336699, Strength=2);width:1">' +
    ((nMenuItemStart > 0) ? '<<' : '__') + '</span></td>';


    Table data links work wonderful in IE but not in NS. Does it not support table data links?
    Brad Eck
    www.sitesdynamic.com

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    477
    Thanks
    0
    Thanked 51 Times in 50 Posts
    Netscape 4 doesn't support mouse events for table structures: onmouseover, onclick, etc. I think it limits mouse events to anchors <a> and images <img>, maybe a few other things.

  • #3
    New Coder
    Join Date
    Mar 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. It's actually NS 6 or 7. More info though, I moved (not removed) an absolute positioned layer that was 'close' (within 100 pixels or so) to the table cells in question and once the layer was out of the way it started working. Now I have two follow-up questions:

    1. The mouse pointer statement (style="CURSOR: hand") doesn't work in NS 6 and 7
    2. Why does a layer not directly over the cell affect it?
    Brad Eck
    www.sitesdynamic.com

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just to clarify - contrary to popular belief, netscape 4 supports most event handlers on most elements, it's just that most of them are not natively handled - you have to set up event listeners yourself. But that's old history.


    1 - because "hand" is proprietary syntax; the correct value is "pointer". But ie5 doesn't understand that, so to get it to work for all you need use both declarations; in this order:

    style="cursor:pointer;cursor:hand;"


    2 - er ... come again?
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #5
    New Coder
    Join Date
    Mar 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    1. thanks! so am I correct intranslating this as use a pointer (if you have it) then use a hand - sort of like a font listing?

    2. sorry for the unclear statement. The on??? functions for my cells are being affected by a layer absolutely positioned 'near' the table - not over it. I move my mouse over the cell and get nothing, but if I move that layer way out of the way I get no problem. Any ideas?
    Brad Eck
    www.sitesdynamic.com

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    1 - not quite; a font-esque listing would be

    cursor:pointer,hand;

    but that won't work right. You have to do two separate declarations:

    cursor:pointer;cursor:hand;


    2 - check the positioned div doesn't have scope you can't see; for eg - a div typically flows all the way from x to the right edge of the page, unless you set an explicit width
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #7
    New Coder
    Join Date
    Mar 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    1. sorry to be thickheaded but what does the browser translate to? I mean, does NS read the first one and IE the second? how does it know? What's the price of tea in china? :-> THANKS!

    2. I could see that impacting it if I was using the width of the div in the calculation but I'm not. It is calculating correctly and all I am setting is the left-most point - in that scenario, should the width matter?
    Brad Eck
    www.sitesdynamic.com

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not necessarily, it depends on where it is; it's just that it sounds from your description like the DIV is covering the TD, and therefore preventing the TD event from happening.

    Maybe you could a link to a page where this happening.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #9
    New Coder
    Join Date
    Mar 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Temporarily add a colored border to the div and it will reveal if its padding or margin overlaps the table.

  • #10
    New Coder
    Join Date
    Mar 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Brothercake - OK, I placed a sample site in http://localhost/sitesdynamic/tdtest/main_test.htm.
    Again, this works wonderful in IE but not in NS.

    Eggman - I tried the border color thing but I couldn't get the coloring in the div (no capability???). I surrounded the div contents with a table and that is what you will see in the above link. I tried forcing a zero width on the div and then setting the table to be 100% (like I would do for a typical table) and it always stretched all the way to the right.

    More: On this page, the div contains the 'test' text in the top center of the page and the broken image below it. Now, because of another problem I am having under NS (I can't get the layer centered on the page accurately) if you size your window the div will move in the X direction at some odd ratio to the page size. Not worrying about that right now, we will use that to our advantage. Size the window so the div table border covers half of the 'main' text. This is its own cell. You will notice the next cell over becomes inactive for about one cell width from the edge of the div. As you size the window to the right you will see that less is available in the active state. Thoughts?

    If you do the same stuff in IE, the centering works so it is always in the same position, but more importantly, click on 'main 2' and the entire 'main' cell will become active no matter how close to the div it is.

    BTW, if you are able to click on the cell it will become inactive (via cookies) as it is the current item selected. To reinstate the original, exit the browser window and reload.
    Brad Eck
    www.sitesdynamic.com

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you linked to localhost ... I'm afraid I don't have your webserver on my computer That link again ...?
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #12
    New Coder
    Join Date
    Mar 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Brad Eck
    www.sitesdynamic.com

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's because you've used an "align" attribute on the DIV, so even though it's absolutely positioned it's still part of the flow of the page, and its position values become absolute only within the constraint of center aligment.

    I'm not sure whether this is correct or not; but you can see it happening - take out the onresize function and you'll see that it still moves when you resize the window.

    So take out the align attribute and you'll get consistency between them.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #14
    New Coder
    Join Date
    Mar 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK - YOU GET THE MEDAL TODAY!!! THANK YOU MUCHO!!!
    Brad Eck
    www.sitesdynamic.com


  •  

    Posting Permissions

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