473,769 Members | 4,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript for Drag file From desktop and drop into webpage

15 New Member
Hi friends,

i need to drag a file from desktop and drop into web page.actually i had did a JS for dragging the images around the web page,but i dont know how to drag the file and drop it into web page.the js code for dragging around webpage is given below

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaS cript">
<!-- Original: Randy Bennett (rbennett@thezo ne.net) -->
<!-- Web Site: http://home.thezone.ne t/~rbennett/sitemap.htm -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.inte rnet.com -->

<!-- Begin
N = (document.all) ? 0 : 1;
var ob;
function MD(e) {
if (N) {
ob = document.layers[e.target.name];
X=e.x;
Y=e.y;
return false;
}
else {
ob = event.srcElemen t.parentElement .style;
X=event.offsetX ;
Y=event.offsetY ;
}
}
function MM(e) {
if (ob) {
if (N) {
ob.moveTo((e.pa geX-X), (e.pageY-Y));
}
else {
ob.pixelLeft = event.clientX-X + document.body.s crollLeft;
ob.pixelTop = event.clientY-Y + document.body.s crollTop;
return false;
}
}
}
function MU() {
ob = null;
}

if (N) {
document.captur eEvents(Event.M OUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}
document.onmous edown = MD;
document.onmous emove = MM;
document.onmous eup = MU;
// End -->
</script>
</HEAD>

<BODY>
<div id="s" style="position :absolute;left: 50;top:300;">
<img src=http://javascript.inte rnet.com/img/cards/spades.gif name="s">
</div>

<div id="d" style="position :absolute;left: 50;top:350;">
<img src=http://javascript.inte rnet.com/img/cards/diamonds.gif name="d">
</div>

<div id="c" style="position :absolute;left: 100;top:300;">
<img src=http://javascript.inte rnet.com/img/cards/clubs.gif name="c">
</div>

<div id="h" style="position :absolute;left: 100;top:350;">
<img src=http://javascript.inte rnet.com/img/cards/hearts.gif name="h">
</div>

Just click and hold the 4 suit images to the left and then you can move them around the page!

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsourc e.com">The JavaScript Source</a></font>
</center><p>

</BODY>
</HTML>[/HTML]
please help me how to drag files from desktop
Dec 19 '06 #1
3 11861
steven
143 New Member
You can't.

When you drag around images on your webpage, this is javascript controlling using the DOM to dynamically position html elements. Your desktop uses neither the HTML DOM nor Javascript.
Dec 19 '06 #2
crazystone82
15 New Member
hi friend,
thanks for replying.suppos e we have textarea is there any javascript to get the path of the file that is to be dropped into browser text area from desktop.if yes please send me the script.its urgernt.
Dec 21 '06 #3
KoviRobi
1 New Member
Yes you can do it in Javascript, I have found theese two links:
Internet Explorer
Firefox
Oct 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
3993
by: Paul | last post by:
Hi, Does anyone know how I would be able to drag a single file onto my applications icon and have it run some predefined code. What I want is to drop an .mp3 file onto my applications icon (not the apps form) and perform the necessary actions then give a confirmation when these actions are done then quit.
1
1471
by: yma | last post by:
Hi, Can I use VS.net to debug the code in the JavaScript (.js) file? Thank you. Chris
2
1208
by: NeverwaY | last post by:
Had an idea and wondered if it is possible at all. Dim Idea1 as New Idea Idea.show() ("I would like to have a spot on a Form, a box of some sort, that if you were to drag a file or folder on to the spot.... it would move that file to a pre-specified folder. I would like to specify the folder in my code so that the user could not change the dir. Example: The program opens and it creates a folder on the desktop called 'Program Name,' then...
8
4553
by: ericgorr | last post by:
I have the following test page: http://ericgorr.net/test.html <html> <head><title>Simple JavaScript</title></head> <BODY ondragstart="alert(event.srcElement.tagName)"> <INPUT TYPE=text VALUE="Select and drag this text"> <SPAN >Select and drag this text</SPAN> <TEXTAREA>Select and drag this text</TEXTAREA>
6
2376
by: popnbrown | last post by:
the title says it how do i put a .swf file on a webpage? I know i'm a noob thank you. Plz help and appreciate it.
2
2553
by: Naha | last post by:
Hi Guys, Does anyone know how to display data from a text file onto a webpage? So far I have opened and read the data in the text file and printed it out on command line, but I am having difficulty of displaying the data from the text file on to the webpage.
1
1790
by: davidemazza82 | last post by:
Hi all, I got an from IE 7.0.5730.11 when moving the <script src="..." type="text/javascript" /tag from the <headpart to the <bodysection of a HTML file. Is not possibile to include Javascript code via <script src="..." type="text/javascript" /from the <bodysection, instead from the <headone? If yes, anyone has any idea of which the problem could be? If not, how can I programmatically include a javascript external file
5
1825
by: Oriane | last post by:
Hi there, I would like to run a javascript file directly from the desktop, like a VBScript file. So my post is perhaps "out of topic" in which case I apologize. The goal is to run this sort of script, which in turn will open an HTML page inside a Windows window: "window.open (http://www..., arg...)"
0
1693
by: chris52672 | last post by:
I have a list view box that shows the files in a directory. I want to drag from the list box to an e-mail window or an explorer window (file folder) and have the file copied to there. Here are the problems I am facing: 1.) When I release the mouse button on a drag event, the dragdrop interrupt only fires when the release is in the ListView box itself (not useful.) I am guessing that I would do an event on the mouse being releaded? 2.) ...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.