input type=file button color

R

Ron Brennan

Good evening.

How can I change the background color of the browse button generated by the
following element?

<INPUT TYPE='file' NAME='test'>

Thank you,
Ron.
 
S

Sid Ismail

: Good evening.
:
: How can I change the background color of the browse button generated by the
: following element?
:
: <INPUT TYPE='file' NAME='test'>


Try inserting
style="background-color:green;"
before >

Sid
 
R

Ron Brennan

No, that won't work. The browse button of the "input type=file" is
different.

Thanks for the suggestion though.


 
J

Jukka K. Korpela

mscir said:

No, it is an example of turning something that works (to the extent that
file submission can work at present) into something that fails to work in
a wide range of situations (including all situations where JavaScript is
disabled, filtered out by a company firewall, not supported etc.).

To do that for the sake of coloring a button is undescribably foolish.
 
M

mscir

Jukka said:
No, it is an example of turning something that works (to the extent that
file submission can work at present) into something that fails to work in
a wide range of situations (including all situations where JavaScript is
disabled, filtered out by a company firewall, not supported etc.).

To do that for the sake of coloring a button is undescribably foolish.

You raise a valid point... How about this approach.

The onclick event is processed without javascript, is this correct? So
how about positioning a div over the button, making it look any way the
OP likes, then clicking the browse button in the div onclick event?

<style type="text/css">
..uploadbox {
font-family: verdana, arial, sans-serif;
font-size: 100%;
color: #800000;
font-weight: normal;
border: #797979 1px solid;
background-color: #ffddbb; //tan
border-color: brown;
width: 292px;
height: 22px;
}
div {
position: absolute;
top: 16px;
left: 205px;
height: 16px;
width: 99px;
font-size: 90%;
background-color: brown;
color: white;
padding: 2px;
z-order: 100;
cursor: hand;
cursor: pointer;
font-weight: bold;
}
</style>
</head>

<body>
<input type="file" class="uploadbox">
<div onclick="fileselect.click();">Select a File...</div>

Mike
 
T

Toby A Inkster

mscir said:
The onclick event is processed without javascript, is this correct? So
how about positioning a div over the button, making it look any way the
OP likes, then clicking the browse button in the div onclick event?

That might work, but use JavaScript to position the <div> instead.

Also, you may get into trouble with the way that some browsers display
form elements (they sometimes put them at an infinitely high z-index).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,619
Members
45,314
Latest member
HugoKeogh

Latest Threads

Top