473,378 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Send image to trash

This script allows the user to click an image and load it in a
different frame.
http://www.walterzorn.com/dragdrop/d...eset/frame.htm

It's pretty cool.

Once I have an image loaded in the left frame, how can I drag that
image to the trash so that it is
removed from the left frame only?

Any help (especially sample code!) you could give would be much
appreciated.

Jul 7 '06 #1
2 1381
1. You should read / know the x and y positions of the trash-bin, and if
its on the right location you can remove the element with DOM. Now I
don't know that API you're using, but it doesn't seem to support events
for seeing when an element has been moved.

2. Removing an element with DOM requires you to know the name or ID of
the element, or have a reference to the actual element. See
document.getElementById and document.getElementsByName

for example:

element = document.getElementsByName('Blah')[0];
element = document.getElementById('Blah');

3. Remove it from the model, for example:

element.parentNode.removeChild(element);

MSDN and Mozilla Developer have good references for DOM, you should
check them out.

Vincent

Jungleman wrote:
This script allows the user to click an image and load it in a
different frame.
http://www.walterzorn.com/dragdrop/d...eset/frame.htm

It's pretty cool.

Once I have an image loaded in the left frame, how can I drag that
image to the trash so that it is
removed from the left frame only?

Any help (especially sample code!) you could give would be much
appreciated.
Jul 7 '06 #2
Thanks! That helps me get started. What I was hoping for was the
functionality exhibited here:

http://demo.script.aculo.us/shop

That is, moving the image to the trash. Any other pointers or hints you
could provide would be great!
Vincent van Beveren wrote:
1. You should read / know the x and y positions of the trash-bin, and if
its on the right location you can remove the element with DOM. Now I
don't know that API you're using, but it doesn't seem to support events
for seeing when an element has been moved.

2. Removing an element with DOM requires you to know the name or ID of
the element, or have a reference to the actual element. See
document.getElementById and document.getElementsByName

for example:

element = document.getElementsByName('Blah')[0];
element = document.getElementById('Blah');

3. Remove it from the model, for example:

element.parentNode.removeChild(element);

MSDN and Mozilla Developer have good references for DOM, you should
check them out.

Vincent

Jul 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: LRW | last post by:
I'm not sure this message is totally appropriate for this group, so please, if anyone has a better group suggestion, let me know! My company sends out a monthly newsletter in HTML format to our...
14
by: George Hester | last post by:
http://hesterloli.dnsalias.com/test/javascript_image.htm The image is the 100x100 px block. If we right-click in it and try to save the image we cannot. Is it possible to say set a mime-type so...
3
by: CroDude | last post by:
Hi all! I've made a little app that creates thumbnails and if user clicks on it, it displays the original picture in the picturebox on a panel control. In a thumbnail mouse down event I'm using...
1
by: saurava | last post by:
I want to make a web page in which I will display some images and also I want to make a recycle bin or trash can inside that web page and when I wanted I should be able to drag that pictures into...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.