SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: set focus

  1. #1
    SitePoint Addict
    Join Date
    Jul 2007
    Location
    San Jose, California
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    set focus

    I'm trying to set the focus to a href but it doesn't seem to work in IE. My code is simple:

    Code HTML4Strict:
    <a href="javascript:function()" id="href_item_id"><img src="source.to.element.jpg"></a>

    I've tried both:
    Code JavaScript:
    document.links['href_item_id'].focus();
    //and
    document.getElementById('href_item_id').focus();

    Both work correct in ff3, but neither works in IE. Anybody know how to remedy this problem?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,710
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Yes, that's a known issue with IE that IE8 should resolve.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •