code work in ie but not in ff

Discussion in 'Javascript' started by shotokan99, Aug 17, 2007.

  1. shotokan99

    shotokan99 Guest

    i just want to ask why this set of functions doesnt work in ff but
    perfectly works in ie:

    document.myform.fname.focus();
    document.myform.fname.select();
     
    shotokan99, Aug 17, 2007
    #1
    1. Advertising

  2. shotokan99

    RobG Guest

    On Aug 17, 1:32 pm, shotokan99 <> wrote:
    > i just want to ask why this set of functions doesnt work in ff but
    > perfectly works in ie:
    >
    > document.myform.fname.focus();
    > document.myform.fname.select();


    They "work" in Firefox 2.0.0.6, though you might like to use feature
    detection before attempting to use them.


    <form>
    <textarea name="ta">textarea text</textarea>
    <input type="text" name="tx" value="input text">
    <input type="button" value="select ta"
    onclick="this.form.ta.select();">
    <input type="button" value="select tx"
    onclick="this.form.tx.select();">
    </form>


    --
    Rob
     
    RobG, Aug 17, 2007
    #2
    1. Advertising

  3. shotokan99

    Steve Swift Guest

    > i just want to ask why this set of functions doesnt work in ff but
    > perfectly works in ie:
    >
    > document.myform.fname.focus();
    > document.myform.fname.select();


    Judging by name (fname) this is applied to an:
    <INPUT TYPE=FILE NAME=fname> tag.

    The functions just work in IE but just don't in FireFox. They don't work
    in Opera or Netscape either. I can't make up my mind if they work or not
    in Safari (for Windows) as it's a totally different sort of control (no
    input area, just a "Choose File" button.

    --
    Steve Swift
    http://www.swiftys.org.uk/swifty.html
    http://www.ringers.org.uk
     
    Steve Swift, Aug 17, 2007
    #3
  4. Steve Swift wrote:
    > shotokan wrote:
    >> i just want to ask why this set of functions doesnt work in ff but
    >> perfectly works in ie:
    >>
    >> document.myform.fname.focus();
    >> document.myform.fname.select();

    >
    > Judging by name (fname) this is applied to an:
    > <INPUT TYPE=FILE NAME=fname> tag.
    >
    > The functions just work in IE but just don't in FireFox. They don't work
    > in Opera or Netscape either. [...]


    The focus() method works in (my) Firefox 2.0.0.6 and Opera 9.22 Build 8801.
    It just does not do what you expect: it moves the focus to the "Browse"
    button next to the input box. Depending on the Netscape version you have
    tested with, it should work in Netscape as well (at least Netscape 6+ which
    is Gecko-based as is Firefox).

    Please provide proper attribution of quoted material, such as above.

    http://www.jibbering.com/faq/faq_notes/clj_posts.html


    PointedEars
    --
    "Use any version of Microsoft Frontpage to create your site. (This won't
    prevent people from viewing your source, but no one will want to steal it.)"
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
     
    Thomas 'PointedEars' Lahn, Aug 17, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. craig dicker
    Replies:
    9
    Views:
    707
    Juan T. Llibre
    Jul 7, 2005
  2. AG
    Replies:
    0
    Views:
    358
  3. jcvoon
    Replies:
    0
    Views:
    375
    jcvoon
    Nov 6, 2007
  4. Koh
    Replies:
    2
    Views:
    222
    Thomas 'PointedEars' Lahn
    May 11, 2004
  5. Heinrich Wolf
    Replies:
    3
    Views:
    422
    Heinrich Wolf
    Apr 29, 2012
Loading...

Share This Page