HighDots Forums  

Image Browse Button

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Image Browse Button in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
shapper
 
Posts: n/a

Default Image Browse Button - 08-25-2007 , 11:07 AM






Hello,

Is there a way to make the browse button an image?

Thanks,
Miguel


Reply With Quote
  #2  
Old   
Steve Swift
 
Posts: n/a

Default Re: Image Browse Button - 08-25-2007 , 02:32 PM






shapper wrote:
Quote:
Is there a way to make the browse button an image?
Two easy ways:

<INPUT TYPE=IMAGE SRC=smiley.gif onClick="alert('Ouch! My nose!')">
<P>
<BUTTON onClick="alert('You clicked the button')">Click: <IMG
SRC=/smiley.gif></BUTTON>

They both have drawbacks, if you plan to submit the form, and not just
use onClick events as I have above:

1. The <INPUT TYPE=TEXT> generates X and Y co-ordinates within the
image. Whatever handles the form has to know what to do with these
2. The <BUTTON> sends some very non-standard form data if the browser is
Internet Explorer. Easier to rely only on the NAME of the button
(which I didn't include above).

You can see this page working at http://swiftys.org.uk/image.html

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk


Reply With Quote
  #3  
Old   
Rik
 
Posts: n/a

Default Re: Image Browse Button - 08-25-2007 , 09:50 PM



On Sun, 26 Aug 2007 02:42:35 +0200, Ben Bacarisse <ben.usenet (AT) bsb (DOT) me.uk>
wrote:

Quote:
Steve Swift <Steve.J.Swift (AT) gmail (DOT) com> writes:

shapper wrote:
Is there a way to make the browse button an image?

Two easy ways:

INPUT TYPE=IMAGE SRC=smiley.gif onClick="alert('Ouch! My nose!')"
P
BUTTON onClick="alert('You clicked the button')">Click: <IMG
SRC=/smiley.gif></BUTTON

I think the OP wants to know how to style the button that often
accompanies <input type=file>.
If that's the question: no, it cannot be done. You cannot style the
'browse' button reliably.
--
Rik Wasmus


Reply With Quote
  #4  
Old   
shapper
 
Posts: n/a

Default Re: Image Browse Button - 08-26-2007 , 05:45 PM



On Aug 26, 3:50 am, Rik <luiheidsgoe... (AT) hotmail (DOT) com> wrote:
Quote:
On Sun, 26 Aug 2007 02:42:35 +0200, Ben Bacarisse <ben.use... (AT) bsb (DOT) me.uk
wrote:

Steve Swift <Steve.J.Sw... (AT) gmail (DOT) com> writes:

shapper wrote:
Is there a way to make the browse button an image?

Two easy ways:

INPUT TYPE=IMAGE SRC=smiley.gif onClick="alert('Ouch! My nose!')"
P
BUTTON onClick="alert('You clicked the button')">Click: <IMG
SRC=/smiley.gif></BUTTON

I think the OP wants to know how to style the button that often
accompanies <input type=file>.

If that's the question: no, it cannot be done. You cannot style the
'browse' button reliably.
--
Rik Wasmus
Yes, I want to style the button that accompanies <input type=file>.

I have seen this one or twice and it seemed to work fine ...

Any idea?

Thanks,
Miguel



Reply With Quote
  #5  
Old   
shapper
 
Posts: n/a

Default Re: Image Browse Button - 08-26-2007 , 05:52 PM



On Aug 26, 3:50 am, Rik <luiheidsgoe... (AT) hotmail (DOT) com> wrote:
Quote:
On Sun, 26 Aug 2007 02:42:35 +0200, Ben Bacarisse <ben.use... (AT) bsb (DOT) me.uk
wrote:

Steve Swift <Steve.J.Sw... (AT) gmail (DOT) com> writes:

shapper wrote:
Is there a way to make the browse button an image?

Two easy ways:

INPUT TYPE=IMAGE SRC=smiley.gif onClick="alert('Ouch! My nose!')"
P
BUTTON onClick="alert('You clicked the button')">Click: <IMG
SRC=/smiley.gif></BUTTON

I think the OP wants to know how to style the button that often
accompanies <input type=file>.

If that's the question: no, it cannot be done. You cannot style the
'browse' button reliably.
--
Rik Wasmus
Hi,

Here is an ASP.NET control that does just that:

http://www.telerik.com/demos/aspnet/...DefaultCS.aspx

A few demos:
http://www.telerik.com/demos/aspnet/...DefaultCS.aspx
http://www.telerik.com/demos/aspnet/...DefaultCS.aspx

This seems to work fine.

How is this done? Any idea?

Thanks,
Miguel




Reply With Quote
  #6  
Old   
Michael Fesser
 
Posts: n/a

Default Re: Image Browse Button - 08-26-2007 , 07:31 PM



..oO(shapper)

Quote:
Yes, I want to style the button that accompanies <input type=file>.
There's no reliable way to do that.

Quote:
I have seen this one or twice and it seemed to work fine ...
Most likely an ugly JavaScript hack.

Micha


Reply With Quote
  #7  
Old   
rf
 
Posts: n/a

Default Re: Image Browse Button - 08-26-2007 , 07:45 PM




"shapper" <mdmoura (AT) gmail (DOT) com> wrote

Quote:
On Aug 26, 3:50 am, Rik <luiheidsgoe... (AT) hotmail (DOT) com> wrote:
On Sun, 26 Aug 2007 02:42:35 +0200, Ben Bacarisse <ben.use... (AT) bsb (DOT) me.uk
wrote:

Steve Swift <Steve.J.Sw... (AT) gmail (DOT) com> writes:

shapper wrote:
Is there a way to make the browse button an image?

Two easy ways:

INPUT TYPE=IMAGE SRC=smiley.gif onClick="alert('Ouch! My nose!')"
P
BUTTON onClick="alert('You clicked the button')">Click: <IMG
SRC=/smiley.gif></BUTTON

I think the OP wants to know how to style the button that often
accompanies <input type=file>.

If that's the question: no, it cannot be done. You cannot style the
'browse' button reliably.
--
Rik Wasmus

Hi,

Here is an ASP.NET control that does just that:

http://www.telerik.com/demos/aspnet/...DefaultCS.aspx

A few demos:
http://www.telerik.com/demos/aspnet/...DefaultCS.aspx
http://www.telerik.com/demos/aspnet/...DefaultCS.aspx

This seems to work fine.
Nope. They don't work fine.

Quote:
How is this done? Any idea?

They are overlaying (z-index) a normal <input type=file> with an <input
type=text> and an <input type=button> and styling the button. They are not
styling the <input type=file> button which is, of course, generated by the
browser.

I didn't research the javascript skulduggery that must be going on behind
the scenes.

--
Richard.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.