Results 1 to 6 of 6

Thread: click() problem in firefox !!

  1. #1
    Join Date
    Sep 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default click() problem in firefox !!

    hello

    i hv a problem.

    Code:
    document.getElementById('s_' + route_id[x] ).click();
    this works in IE fine but not in FF. i want this works when page is loaded. no mouse click is needed for that. it works in IE fine, but in firefox, no working

    any solution?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The .click() object is non-standard. I think that one or two other browsers besides IE do support it, but FF is not one of them.

    To answer your question, if what you want to fire is document.getElementById('s_' + route_id[x] )'s hard coded or its directly assigned by script (not created by addEventListener) onclick event, you can do (or something similar, depending upon the sort of event you are firing):

    Code:
    document.getElementById('s_' + route_id[x] ).onclick.apply(document.getElementById('s_' + route_id[x] ));
    Otherwise, it could be fairly to very complicated, and depending upon what exactly you want to do, may not be possible via any type of click emulation. If there is any way to determine and execute whatever action you want to take other than by simulating a click, that would be the way to go.

    I could be more specific if I saw your page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hello John

    thanks for ur reply.

    but it's not working yet.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I did say it depended upon what you are actually doing. It isn't an exactly equivalent replacement for .click().

    Please post a link to the page on your site that contains the problematic script so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Sep 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i want to select a object during loading the page. for that i used .click() which is working in IE. but in ff it isn't.

    ur solution not works in IE or FF.
    in IE it says "object required".

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please post a link to the page on your site that contains the problematic script so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •