Javascript - Need to hide Status bar message for links

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arielle
    New Member
    • Jul 2006
    • 76

    #1

    Javascript - Need to hide Status bar message for links

    Be it far beyond me as to why but I am merely a worker bee the customer has decided that he doesn't want the links URL to appear in the status bar but instead wants a message like "Click to open" to appear instead.

    I've looked up a few different ways but the way I've seen doesn't actually work. I would like code that will work for all links that I can just shove into a global script instead of adding a function to each individual links.

    This does NOT work
    <script language="javas cript">
    function hidestatus(){
    window.status=' '
    return true
    }

    if (document.layer s)
    document.captur eEvents(Event.M OUSEOVER | Event.MOUSEOUT)

    document.onmous eover=hidestatu s
    document.onmous eout=hidestatus
    </script>

    If I use the hidestatus function in a link that calls it--it does work however is there a way to do this automatically so I don't have to go through five bazillion links?

    What works:
    <a href="test.aspx " onmouseover="re turn hidestatus()">T est Page</a>
  • Arielle
    New Member
    • Jul 2006
    • 76

    #2
    I've decided to take a different approach. I now call a function from the onload attribute of the function that calls the following.

    function hideStatusLinks ()
    {
    var doc = document.body.g etElementByTag( "a");
    for (var x=0;x<doc.lengt h;x++)
    {
    doc[x].setAttribute(" onmouseover",hi deLink);
    }
    }

    function hideLink()
    {
    window.status = "Frogs like teacups";
    }


    But it -still- doesn't work. If I change the window.status to alert("Frogs"); it works perfectly so I'm starting to wonder about the changing of the status. It's one of those problems that is kicking my butt but I bet tonight I'll suddenly get a eureka.

    Comment

    • sashi
      Recognized Expert Top Contributor
      • Jun 2006
      • 1749

      #3
      Hi there,

      the simplest solution is..

      example 1..
      Code:
      <a href="http://www.somewhere.com" onMouseOver="window.status='Some Message Text Here'; return true;">Link Name</a>
      example 2..
      Code:
      <script language="JavaScript">
      function writetostatus(input){
          window.status=input;
          return true;
      }
      </script>
      usage..
      Code:
      <a href="http://www.somewhere.com" onMouseover="writetostatus('Some Message Text Here')"
      onMouseout="writetostatus('')">Link Name</a>
      i have been the second example on all my web projects and it works fine.. hope it works fine for you too.. good luck my fren.. :)
      Last edited by sashi; Jul 11 '06, 04:10 PM.

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        I think

        doc[x].setAttribute(" onmouseover",hi deLink);

        needs to be

        doc[x].setAttribute(" onmouseover","h ideLink();");

        Comment

        • Arielle
          New Member
          • Jul 2006
          • 76

          #5
          Thanks,

          Yeah I knew about that one I was just trying to see if there was a way to dynamically generate it rather than go through all the links on the website. (It's a very large website... )

          In the end I just ended up doing a very large search & replace...

          Comment

          • iam_clint
            Recognized Expert Top Contributor
            • Jul 2006
            • 1207

            #6
            <script>
            function hidestatus(){
            window.status=' How ya doin there captain!'
            return true
            }

            document.onmous eover=hidestatu s
            document.onmous eout=hidestatus
            </script>

            Comment

            • audiophiler
              New Member
              • Feb 2007
              • 1

              #7
              Originally posted by sashi
              Hi there,

              the simplest solution is..

              example 1..
              Code:
              <a href="http://www.somewhere.com" onMouseOver="window.status='Some Message Text Here'; return true;">Link Name</a>
              example 2..
              Code:
              <script language="JavaScript">
              function writetostatus(input){
                  window.status=input;
                  return true;
              }
              </script>
              usage..
              Code:
              <a href="http://www.somewhere.com" onMouseover="writetostatus('Some Message Text Here')"
              onMouseout="writetostatus('')">Link Name</a>
              i have been the second example on all my web projects and it works fine.. hope it works fine for you too.. good luck my fren.. :)

              Hey I was wondering where exactly you should put the codes in at the html. Sorry I'm a newbie at html so was hoping you could help me. Do I put it between <head>? Any help would be appreciated.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by audiophiler
                Hey I was wondering where exactly you should put the codes in at the html. Sorry I'm a newbie at html so was hoping you could help me. Do I put it between <head>? Any help would be appreciated.
                Welcome to The Scripts.

                You can put the javascript code in between the head tags. that should work fine. You can also put it in the body tags. See this page for more information.

                Comment

                Working...