hide/show hyperlinks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prinsipe
    New Member
    • Jun 2007
    • 14

    #1

    hide/show hyperlinks

    Hi all,

    what i'm doing is showing/hiding hyperlinks depending on the hyperlink clicked. it is partially working. when i call step1, all hyperlinks are hidden. but then i call step2, single and mulitple is visible. the problem is when i call step1 again, it does not hide single and multiple hyperlinks. any idea to solve my problem? thanks in advance! below is my sample script...

    function Step1()
    {
    document.all.di sappear.style.v isibility = "hidden";
    }
    function Step2(single, multiple)
    {
    document.all.di sappear.style.v isibility = "hidden";
    document.getEle mentById(single ).style.visibil ity = "visible";
    document.getEle mentById(multip le).style.visib ility = "visible";
    }

    by the way, i used <span id="disappear" > to hide the hyperlinks...
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    when hiding the links I would hide them individually instead of in a span or div
    using code something like this. then unhide individual links.
    [CODE=javascript]
    var links = document.getEle mentsByTagName( "A");
    for (i=0; i<links.length ; i++) {
    links[i].style.visibili ty = "hidden";
    }
    [/CODE]

    Comment

    • prinsipe
      New Member
      • Jun 2007
      • 14

      #3
      Originally posted by iam_clint
      when hiding the links I would hide them individually instead of in a span or div
      using code something like this. then unhide individual links.
      [CODE=javascript]
      var links = document.getEle mentsByTagName( "A");
      for (i=0; i<links.length ; i++) {
      links[i].style.visibili ty = "hidden";
      }
      [/CODE]
      hi clint

      i'm using asp .net. i used asp to create the hyperlinks. im having a hard time getting the controls in asp and manipulate them in javascript. when i set the property of hyperlinks (around 20) to visible = false in asp .net (on page load, i want almost all links to be hidden. then by clicking a link, some links should be visible and others should be hidden), i can not set it to visible using javascript...

      Comment

      • iam_clint
        Recognized Expert Top Contributor
        • Jul 2006
        • 1207

        #4
        your server side app has nothing todo with this. So if that code don't work for you show me your code and I will continue to help you.

        visible = false is wrong
        visibility = 'hidden'; is right
        and to make them visible is
        visibility = 'visible';

        Comment

        Working...