Solved

Javascript Browse Button

Posted on 2009-04-06
3
574 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
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
Dean OBrien earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now