Changing BROWSE... text from file class form ...

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Changing BROWSE... text from file class form ...

Postby WoozyDuck » Sun Aug 15, 2004 10:27 am

does anybody know how to change [BROWSE...] text from a File Class form ?

Code: Select all

  <input type="file" name="F1" size="20">


User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Sun Aug 15, 2004 12:05 pm

I don't believe there is a way. It's something that is rendered by the browser specifically.

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Sun Aug 15, 2004 12:35 pm

yes I think the same actually

but is there any way to make our own browse button for a textbox ?
My plan is to make an upload page , so I have to have a textbox
and a button which browses the files for that textbox ...
but I like to show another text instead of BROWSE... in that
button , so maybe I can use a normal button to do that ?
is there any way , maybe using JavaScript or something
that works in INTERNET EXPLORER and NETSCAPE ...

Best regards

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Sun Aug 15, 2004 1:06 pm

well
Ive found a way to do it ...

Code: Select all

<html>
<head></head>
<body>
<form name="test_form" method="post" action="test.jsp">
<input type=file name=browse style="display: none;" size="20">
<input type=text name=file size="20">
<input type=button
       style="font-style:veranda; font-size:12px; font-weight:bold;text-transform:lowercase;color:white;background-color:#A2C382;height:22px;border-style:ridge;text-align:center;"
       onClick="browse.click();file.value=browse.value;"
       value="Select a File...">       
<br><br>
<input type=submit
       value="Submit The Form Now!"
       style="font-style:veranda; font-size:12px;">     
</form>
</body>
</html>



this code even changes the button color and style ;)
Thanx

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Sun Aug 15, 2004 6:01 pm

:shock:
Neat !
Cause this line doest work in Netscape :

Code: Select all

browse.click();


:eek:

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Postby ruturajv » Sun Aug 15, 2004 7:23 pm

easy...
use this..

Code: Select all

document.forms['test_form'].elements['browse'].click();


And don't forget to add quotes to attribute values

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Mon Aug 16, 2004 4:41 am

Thank you very much for your answer ...
but it still doesnt work in NETSCAPE (it works in IE) ...

here is my code :

Code: Select all

<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>

<form name="test" method="POST" enctype="multipart/form-data" action="--WEBBOT-SELF--">
  <p>
    <input name="browse" type="file" name="F1" size="20">
  </p>
  <p>
    <input type="button" onclick="document.forms['test'].elements['browse'].click();" value="Click Browse ..." name="B1">
  </p>
</form>

</body>
</html>



Is there anything wrong with my code ?

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Mon Aug 16, 2004 5:41 am

Apart from the fact that it's FrontPage-generated, doesn't declare a doctype, and won't validate? I don't think so.

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Postby ruturajv » Mon Aug 16, 2004 7:32 pm

what version of netscape are you using.... ?
The thing I gave u is in the Javascript 1.3 reference manual... !

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Tue Aug 17, 2004 4:42 pm

I am using Netscape version 7.1
but if there is a code depends on the version
of browser , I will drop it anyway
cause I will have hundred of users and I cannot
tell them to use a special version of a browser !
but thanx for help :)

finally I divide them into t different codes ...
one for Internet Explorer
and another one for other browsers ...
so if somebody browse this upload page with IE
he can see its difference , otherwise Ive used the
normal code.

now I have a new problem which I like to solve ...
as you may know , I have this code now :

Code: Select all

<html>
<head></head>
<body>
<form name="test_form" method="post" action="test.jsp">
<input type=file name=browse style="display: none;">
<input type=text name=file>
<input type=button
       style="font-style:veranda; font-size:12px; font-weight:bold;text-transform:lowercase;color:white;background-color:#A2C382;height:22px;border-style:ridge;text-align:center;"
       onClick="browse.click();file.value=browse.value;"
       value="Select a File...">       
<br><br>
<!-- must be clicked twice for the form to submit! -->
<input type=submit
       value="Submit The Form Now!"
       style="font-style:veranda; font-size:12px;">     
</form>
</body>
</html>


it works fine , but I should clikc SUBMIT button twice to submit the form !!!!!!! any idea or any solution for this problem ?
:-o


Return to “HTML Basics”

Who is online

Users browsing this forum: No registered users and 2 guests