hange the text of browse button in file upload control

Discussion in 'HTML' started by lale.kat@gmail.com, Nov 28, 2007.

  1. Guest

    Hi.I want to change the text of browse button in file upload control
    in firfox,for example insted of being "browse" be "upload file", how
    can I do that?
    Is it possible ?I found a code that only works in IE but it doesent
    work in fireFox, I want to work in both of them.

    <html>
    <head>
    <title>File Upload Example</title>
    <script language="JavaScript" type="text/javascript">
    function HandleFileButtonClick()
    {
    document.frmUpload.myFile.click();
    document.frmUpload.txtFakeText.value =
    document.frmUpload.myFile.value;
    }
    </script>
    </head>
    <body>
    <form name="frmUpload" encType="multipart/form-data">
    <!-- Real Input field, but hidden-->
    <input type="file" name="myFile" style="display: none">
    <!-- Fake field to fool the user -->
    <input type="text" name="txtFakeText" readonly="true">
    <!-- Button to invoke the click of the File Input -->
    <input type="button" onclick="HandleFileButtonClick();"
    value="Upload File" >
    </form>
    </body>
    </html>
    -----------------
     
    , Nov 28, 2007
    #1
    1. Advertising

  2. wrote:
    > Hi.I want to change the text of browse button in file upload control
    > in firfox,for example insted of being "browse" be "upload file", how
    > can I do that?
    > Is it possible ?I found a code that only works in IE but it doesent
    > work in fireFox, I want to work in both of them.
    >


    <snip javascript hack>

    Good Firefox! Anyway what happens if the user has JavaScript disabled?
    What not use the dependable recommended method?

    <label for="MyFile">Upload File: </label>
    <input type="file" name="myFile" id="myFile">

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Nov 28, 2007
    #2
    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. bsm
    Replies:
    0
    Views:
    1,325
  2. Bibhu Behera
    Replies:
    1
    Views:
    154
    Bassel Samman
    Mar 13, 2009
  3. bsm
    Replies:
    3
    Views:
    290
  4. Replies:
    0
    Views:
    222
  5. Replies:
    8
    Views:
    497
Loading...

Share This Page