SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  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??

    Hi people actually i started a thread in HTML forum by thinking that it would have solution ...

    Quote Originally Posted by kvijayhari View Post
    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
    Quote Originally Posted by AutisticCuckoo View Post
    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}

    can you people pls help with a sample code to disable a link or a <td>..
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post the code you have written so far. Or, hire a web programmer. This isn't a forum for free web programming services. This is a forum for helping people learn javascript.

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    7stud, that's a bit harsh, isn't it?

    Viju, you'll have to provide more detail about what your markup looks like as well as how and when you want these things to be disabled.

    If you can't figure out what to do from the code snippet I posted, there's a risk that this is going to be too complicated for you. In that case, you might want to heed 7stud's advice and bring in someone to help you with the coding.

    Another option is that you learn some basic JavaScript and DOM so that you can do this yourself. That's beyond the scope of this forum to provide, however.
    Birnam wood is come to Dunsinane

  4. #4
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another option is that you learn some basic JavaScript and DOM so that you can do this yourself. That's beyond the scope of this forum to provide, however.
    Learning Javascript/DOM is precisely the scope of this forum!

    * mike pokes tommy in the ribs and giggles *

    kvijayhari, give us a link to your page and we will be glad to help you

    ... maybe ...

    just kidding!

    Where's my coffee!!!

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MikeFoster View Post
    Learning Javascript/DOM is precisely the scope of this forum!
    Indeed ... that was poorly phrased by me. I meant that we cannot educate someone from zero knowledge to JavaScript guru within a single thread.

    Quote Originally Posted by MikeFoster View Post
    * mike pokes tommy in the ribs and giggles *
    I'll let you get away with that since it's Valentine's Day and all.
    Birnam wood is come to Dunsinane

  6. #6
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    Hey, you look good in green. Congrats!

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Mike!
    Birnam wood is come to Dunsinane

  8. #8
    I'm not a human
    Join Date
    Aug 2006
    Location
    India
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi guys ,

    i've sorted it out and it's working very nicely. The concept which AutisticCuckoo gave me helped me to solve it.


    Quote Originally Posted by AutisticCuckoo View Post
    7stud, that's a bit harsh, isn't it?

    Viju, you'll have to provide more detail about what your markup looks like as well as how and when you want these things to be disabled.

    If you can't figure out what to do from the code snippet I posted, there's a risk that this is going to be too complicated for you.
    i haven't posted that code because i thought that it would be a very nice little code or portion which can be writtten of easily by the experts. and i thought it not necessary to post all my code because a it's nothing to see there.

    Quote Originally Posted by MikeFoster View Post
    Learning Javascript/DOM is precisely the scope of this forum!

    kvijayhari, give us a link to your page and we will be glad to help you
    thank you

    Quote Originally Posted by AutisticCuckoo View Post
    I meant that we cannot educate someone from zero knowledge to JavaScript guru within a single thread.
    yes u r right ,, as i noted earlier i thought it would be a very silly question i've asked to post with code and all other details.

    i'm slowly going thru the javascript and dom ... so i'll post more and more appropriately.

    thanks guys
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  9. #9
    SitePoint Enthusiast Tygatur's Avatar
    Join Date
    Apr 2006
    Location
    Germany
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simply overwrite the link target with the link itself.

    function linkkill(linker)
    {
    var aname="a"+Math.random();
    linker.id=aname;
    linker.href="#"+aname;
    }

    This code should change the link to an anchor pointing to itself.
    to code or not to code ?
    that's too much of a question for a signature.


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
  •