faqts : Computers : Programming : Languages : JavaScript : Forms : File Upload

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

94 of 134 people (70%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Can the "Browse..." button be an image?

Aug 16th, 2002 02:49
Mayank Jain, Paul Johansson, jsWalter, Gareth Walker,


Is there any way to do this, to change the "Browse..." button to an 
image? I only get the error message "Access denied"...
Best regards
Paul
==========================================================
Note: 2/26/2001 - WT
It seems that this code no longer works in IE.
As of 5.x I get an "access is denied" error.
I figure MS must have 'fixed' this during the last rev.
I have no solutions as of now. Anyone have a guess on this?
============================================================
Original post 9/2000 - wt
This is how I solved this issue.
All you need for this to work are 2 image, an up and a down image.
Just drop this into your form, change the path and image names and your 
in business.
Any questions drop me a line.
Walter
=================================
		<b><i>Filename:</i></b>
		<input type=file
			   name='file1'
			   size='15'
			   class='walter'
			   style='display: none;'>
		<br>
		<input type='text'
		       name='file2'
		       id='file2'>
		<img src='images/browse-up.gif'
			 name='brower'
			 id='brower'
			 width='83' height='24' border='0'
			 alt=''
			 align='absmiddle'
			 onclick='document.all.file1.click(); 
document.all.file2.value=document.all.file1.value'
			 onMouseDown='this.src="images/browse-dn.gif"'
			 onMouseUp='this.src="images/browse-up.gif"'
			 onMouseOut='this.src="images/browse-up.gif"'>
=======================================================================
Hi Walter,
I tried this code on IE 6.0. It works fine. But when I tried the same 
thing on Netscape 4.77, it doesn't work. It doesn't even throw a 
javascript error. Is there any other workaround which can work on 
Netscape 4.77.
Thanks,
Mayank