SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    I'm not a human
    Join Date
    Aug 2006
    Location
    India
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to disable link or td??

    i want to disable a link and it should not redirect to the specified page.

    also i want to disable a <td> that means whatever the <td> contains should also be disabled..

    what should i do ??

    i tried disabled for the link and it produces a disable like view in IE7 but when clicked it goes to the target page and in firefox and mozilla the disable has no effect..


    pls help to sort this out
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The disabled attribute is only supported for the element types BUTTON, INPUT, OPTGROUP, OPTION, SELECT and TEXTAREA. Not for links or table cells.

    The only compliant way to achieve what you are after is to use JavaScript (optionally along with some CSS to style the 'disabled' elements).
    Birnam wood is come to Dunsinane

  3. #3
    I'm not a human
    Join Date
    Aug 2006
    Location
    India
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you hlp with an example code for this...

    if u can please...
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This really belongs in the JavaScript forum, but here's something to give you an idea. Let's assume that the link you want to disable has an ID equal to 'foo'.
    Code:
    var a = document.getElementById("foo");
    a.className = "disabled";
    a.onclick = function() {return false};
    By setting the class to 'disabled', we can easily style the 'disabled' link with CSS:
    Code:
    a.disabled {color:#999; cursor:default}
    Birnam wood is come to Dunsinane


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
  •