JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 9th, 2008, 09:19 AM
bonechair's Avatar
bonechair bonechair is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: Cape Town
Posts: 469 bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 44 m 33 sec
Reputation Power: 10
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

Reply With Quote
  #2  
Old May 9th, 2008, 01:16 PM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,040 Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Ebot User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)  Folding Points: 10015 Folding Title: Novice Folder
Time spent in forums: 1 Week 3 Days 3 h 37 m 17 sec
Reputation Power: 462
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!

Reply With Quote
  #3  
Old May 10th, 2008, 07:27 AM
bonechair's Avatar
bonechair bonechair is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: Cape Town
Posts: 469 bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 44 m 33 sec
Reputation Power: 10
No I want to choose a file for upload when I double click

Reply With Quote
  #4  
Old May 10th, 2008, 09:53 AM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,278 lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 17 m 36 sec
Reputation Power: 564
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.

Reply With Quote
  #5  
Old May 11th, 2008, 10:57 AM
bonechair's Avatar
bonechair bonechair is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: Cape Town
Posts: 469 bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level)bonechair User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 44 m 33 sec
Reputation Power: 10
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?

Reply With Quote
  #6  
Old May 11th, 2008, 02:48 PM
ktoz ktoz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 420 ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 3 h 45 m 42 sec
Reputation Power: 25
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:
Original - html Code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> <html>     <head>         <title>File Chooser</title>         <script language='javascript'>                     function JSChooseFile()             {                 var evt   = document.createEvent('MouseEvent');                 var node        = document.createElement('input');                                 // init evt and node attributes                 evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);                    node.setAttribute('type', 'file');                 node.style.visibility   = 'hidden';                                 // add temporary input field to document                 document.body.appendChild(node);                                 // NOTE: alert get summoned before user selects a file so                 // will need some sort of setInterval to check for non nil node.value                 if (node.click())                 {                     alert(node.value);                 }                 else if (node.dispatchEvent(evt))                 {                     alert(node.value);                 }                                 // remove temporary input field from document                 document.body.removeChild(node);             }         </script>     </head>     <body>          <img src='http://www.focuspocus.org/photodata/0124_jellyfish.jpg' ondblclick='JSChooseFile()'>     </body> </html>

Last edited by ktoz : May 11th, 2008 at 02:58 PM.

Reply With Quote
  #7  
Old May 11th, 2008, 02:50 PM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,278 lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 17 m 36 sec
Reputation Power: 564
Yes, there is an ondblclick event, did you check Google?

Reply With Quote
  #8  
Old May 11th, 2008, 07:33 PM
ktoz ktoz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 420 ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 3 h 45 m 42 sec
Reputation Power: 25
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:
Original - html Code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> <html>     <head>         <title>File Chooser</title>         <script language='javascript'>                     function JSChooseFile(inEvent)             {                 var t      = this;                                 t.target    = inEvent.target;                 t.node    = document.createElement('input');                                 t.node.setAttribute('type', 'file');                 t.node.style.visibility  = 'hidden';                                 document.body.appendChild(t.node);                                 t.node.click();                                 t.interval  = setInterval(function() { t.checkValue(); }, 100);             }                         JSChooseFile.prototype.checkValue = function()             {                 var t      = this;                                 if (t.node.value != '')                 {                     clearInterval(t.interval);                     t.url   = t.node.value.replace(/\s/g, '%20'); // replace spaces with '%20'                     document.body.removeChild(t.node);                                         alert(t.url);                     // you'll need to add XMLHTTPRequest code here                     // to upload the file to a server script                 }             }                     </script>     </head>     <body>          <img src='http://www.focuspocus.org/photodata/0124_jellyfish.jpg' ondblclick='new JSChooseFile(event)'>     </body> </html>


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.

Reply With Quote
  #9  
Old May 13th, 2008, 04:24 AM
ktoz ktoz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 420 ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 3 h 45 m 42 sec
Reputation Power: 25
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Double click image to upload


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |