Solved

Javascript Browse Button

Posted on 2009-04-06
3
579 Views
Last Modified: 2012-05-06
I want to use a graphical image as a browse button rather than html's inherent file button, so I will have to call a Javascript function at the onclick event that mirrors what the html file button does (launches a file browsing window). Does anybody know the function? If there is a .submit a .open, a .close and a .print, then there must be a sort of .browse function but I can't seem to find that on the net. Everybody talks about the html file button. Basically, I need the function to launch the browse window and then display the path of the file in a text box next to it after the file has been selected and the window is closed, and then have that file get sent. I know it's got to be easy, but i can't find it. Thanks in advance
0
Comment
Question by:BobHavertyComh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
Dean OBrien earned 500 total points
ID: 24078025
Hey Bob,

I believe this should work:
<form id="form1">
 <input size="40" id="fbutton" type="file" style="display:none">
 <img src="graphicFileName.jpg" onclick="form1.fbutton.click()">
</form>

Easynow
0
 
LVL 9

Author Closing Comment

by:BobHavertyComh
ID: 31567045
Now that's an interesting little trick. I haven't tried it but I can see exactly what you're doing, and it's probably the easiest thing to do and it will work, so I'll awards the points
0
 
LVL 12

Expert Comment

by:Dean OBrien
ID: 24078235
Just realised that the text box would also be hidden... that being the case an option might be to place the new image over the top of the button instead of hiding it.
Good luck, cheers for the points
Easynow
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question