Results 1 to 2 of 2

Thread: Focus on Links

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Posts
    150

    Focus on Links

    Hi all!

    Is there a javascript command that can put the focus on a link?

    I've tried the .focus() command and it doesn't work

    Thanks

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Strange, that should be the way to do it. Try this code and run it in your browser...

    Code:
    <html>
    <head>
    <title>Untitled</title>
    <script language="JavaScript" type="text/javascript">
    <!--
    function setFocus(){
      document.getElementById('test2').focus()
    }
    //-->
    </script>
    
    </head>
    <body>
    <a id="test" href="">test</a>
    <a id="test2" href="">test2</a>
    <div onclick="setFocus();">Click Me</div>
    </body>
    </html>
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

Posting Permissions

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



Click Here to Expand Forum to Full Width