|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Double click image to upload
Hi I is possible to double click an image and then get it to return the browse on this:
<input type="file" size="40" name="datafile"/> Then obviously hiding it to.
__________________
http://www.capeseo.com |
|
#2
|
||||
|
||||
|
I'm not quite sure what you asking. you want to set the value of your input when someones double clicks? Or do you want the broswer to go whereever the value of your input is?
__________________
The liver is evil and must be punished! |
|
#3
|
||||
|
||||
|
No I want to choose a file for upload when I double click
|
|
#4
|
|||
|
|||
|
Double click what? The image? How (or why) would you upload an image that was already on the server?
__________________
BookMooch.com : Give books away. Get books you want. |
|
#5
|
||||
|
||||
|
It's for a cms to change the picture. Double click picture and then that opens the small file browse window. ondblclick='??' Is there a function for this?
|
|
#6
|
|||||
|
|||||
|
This isn't complete yet (I couldn't get 'click()' or 'dispatchEvent()') working in Firefox), but it does summon a choose file dialog in Safari when you double click on a photo.
Perhaps you (or someone else) could figure out how to make it cross-browser compatible. html Code:
Last edited by ktoz : May 11th, 2008 at 02:58 PM. |
|
#8
|
|||||
|
|||||
|
I took another crack at it and included an interval that tests when the node.value contains a file path. It still only works in Safari. Firefox seems to have either intentionally disabled invoking 'click()' programatically or it has a bug. Not sure which.
html Code:
You'll still need to upload the file to a server script using XMLHTTPRequest, which will need to put it in a place that is accessible to the page, but this gets you a little closer. |
|
#9
|
|||
|
|||
|
Firefox bug
The inability to call node.click() from a Javascript in Firefox is a known bug that has been around for more than eight years. There appear to be a group of purists on the Mozilla team who have dug in their heels about allowing Javascripters the ability to programatically invoke the file chooser dialog and are stubbornly preventing it from being implemented.
The dark side of open source - individuals who refuse to implement a feature out of ideological purity. I think you're out of luck with this one unless you can restrict your users to only use Safari.. Last edited by ktoz : May 13th, 2008 at 04:45 AM. |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > Double click image to upload |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|