?
Solved

Javascript Browse Button

Posted on 2009-04-06
3
Medium Priority
?
584 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

752 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