473,396 Members | 1,921 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,396 software developers and data experts.

Deleting effect like icon-recycle bin

Hi guys,
I have to simulate the removing of a file in Windows with javascript: in
other words I drag an image above a layer and the image disappears (like the
recycle bin).

I know (or better I thought to know) the way to write the script: in effect
I'm not able to indicate to browser that the image is above the layer.

This is the code (in short):

<img id="to_remove" title="File unnecessary" />

<div id="recycle_bin" onmouseover="verify('onmouseover');"
onmouseout="verify('onmouseout');">
The recycle bin. Drag an image here to remove it.
</div>

The function verify() is:

var recycle_bin=false;

function verify(_event) {
if (_event=="onmouseover") {
recycle_bin=true;
} else if (_event=="onmouseout") {
recycle_bin=false;
}
}

After, in the document.onmouseup event:

document.onmouseup=function() {
// ...here the code to stop drag'n'drop
if (recycle_bin) {
alert("Image removed");
}
}

The trouble is that when I drag the image above the layer, the onmouseover
event of the layer is not executed (in effect the cursor is onmouseover the
image I'm dragging). How can I do? Do you have alternative ideas or you know
how script.aculo.us do?

Thanks in advance.

--
Luke S.
Dec 10 '05 #1
18 1946
why don't you use script.aculo.us?
Luke Skywalker schrieb:
[...]
The trouble is that when I drag the image above the layer, the onmouseover
event of the layer is not executed (in effect the cursor is onmouseover the
image I'm dragging). How can I do? Do you have alternative ideas or you know
how script.aculo.us do?


Dec 10 '05 #2
> why don't you use script.aculo.us?

'cause I don't understand how they do to make the effect I'm looking for and
the whole script is too large (and complex) for my target (it would be like
to use a gun to kill a mosquito).
I tried to read the scripts but I didn't find where script.aculo.us specify
how to execute the onmouseover of the layer.

Thanks however for your reply. Someone else can help me?

--
Luke S.
Dec 10 '05 #3
Luke Skywalker wrote:
I have to simulate the removing of a file in Windows with javascript: in
other words I drag an image above a layer and the image disappears (like
the recycle bin).

I know (or better I thought to know) the way to write the script: in
effect I'm not able to indicate to browser that the image is above the
layer.
That is not a question of script programming.
This is the code (in short):

<img id="to_remove" title="File unnecessary" /> ^
IE does not support XHTML, --------------------'
and in HTML that is equivalent to "<img ...>&gt;",
unless falsely error-corrected.

Furthermore, this `img' element lacks the `alt' attribute value
to be Valid (X)HTML.

<URL:http://validator.w3.org/>
<div id="recycle_bin" onmouseover="verify('onmouseover');"
onmouseout="verify('onmouseout');">
The recycle bin. Drag an image here to remove it.
</div>
The `div' element was included after the `img' element, hence it
will always be displayed on top of it, unless specified otherwise,
e.g.:

<img src="..." alt="..." style="z-index:2">

<div ... style="z-index:1">...</div>

See <URL:http://www.w3.org/TR/CSS2/visuren.html#propdef-z-index>
for details.
[...]
The trouble is that when I drag the image above the layer, the onmouseover
event of the layer is not executed (in effect the cursor is onmouseover
the image I'm dragging). How can I do? Do you have alternative ideas
Use the ondrag* event handlers. Since they are not part of Valid HTML, you
have to assign the event listeners through scripting in order to keep your
markup Valid.

<URL:http://xulplanet.com/references/elemref/ref_EventHandlers.html>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/dhtml_node_entry.asp>
or you know how script.aculo.us do?


Read the Source, Luke. [1]
PointedEars
___________
[1] That's my usual reply, but it could not fit better here :)
Dec 10 '05 #4
> That is not a question of script programming.

I don't understand what you mean... what's my question?
Furthermore, this `img' element lacks the `alt' attribute value
to be Valid (X)HTML.
I write the code on the fly, just to explain better my question. Sorry for
the errors.
Use the ondrag* event handlers. Since they are not part of Valid HTML, you have to assign the event listeners through scripting in order to keep your
markup Valid.

<URL:http://xulplanet.com/references/elemref/ref_EventHandlers.html>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/dhtml_node_entry.asp>


Thanks for your time, I'm trying with the posted urls.

Luke S.
Dec 10 '05 #5
Luke Skywalker wrote:
That is not a question of script programming.
I don't understand what you mean... what's my question?


Your problem that the `div' element is displayed above the `img' element (on
the z-axis) when the latter is dragged on it is not something that is to be
solved by script programming (the figure of speech for this being AFAIK "is
not a question of ...").
Use the ondrag* event handlers. Since they are not part of Valid HTML,

you

^^
Please visit <URL:http://insideoe.com/> to work around the major flaws
in the NetNews client software you are using, or consider switching to
better software, like Mozilla Thunderbird.

<URL:http://www.mozilla.com/thunderbird/>

And please provide attribution of quoted material in the future, as
described in the newsgroup's FAQ:

<URL:http://jibbering.com/faq/faq_notes/pots1.html>
Thanks for your time, I'm trying with the posted urls.


You're welcome.
PointedEars
Dec 10 '05 #6

Thomas 'PointedEars' Lahn napisal(a):
<img id="to_remove" title="File unnecessary" />

^
IE does not support XHTML, --------------------'
and in HTML that is equivalent to "<img ...>&gt;",
unless falsely error-corrected.

This statement is wrong in my assumption. For HTML source code the
appropriate parser is called 'soap parser'. It means that is it will
'skip all not known elements of markup'. For my perspective the:
<img id="to_remove" title="File unnecessary" alt="remove_image" />
, is perfectly good - it is well 'understood' by common HTML parsers
and furthermore it is valid under XHTML. Notice however that there is a
space between " and /> - if omitted it could make trouble.

If my words are not true - point me an address/resource/whatever which
says otherwise.

Best regards.
Luke.

Dec 11 '05 #7
Luke Matuszewski wrote:
Thomas 'PointedEars' Lahn napisal(a):
> <img id="to_remove" title="File unnecessary" /> ^
IE does not support XHTML, --------------------'
and in HTML that is equivalent to "<img ...>&gt;",
unless falsely error-corrected.


This statement is wrong in my assumption.


Your assumption is what is wrong here.
For HTML source code the appropriate parser is called 'soap parser'.
The appropriate parser für HTML is an SGML parser as that is an SGML
application per its Specifications.[1] That few Web browsers use such
a strict parser does not make the parsed code correct or even Valid,
because Web browsers are only a subset of HTML user agents. Therefore
I wrote "falsely error-corrected"; that false error-correction (correct
would be to render the markup as described) is part of the behavior of
"_tag soup_ parsers" in Web browsers; it is not of the W3C Markup
Validator[2], _e.g._

Non-Valid markup is non-interoperable markup, which is a Bad Thing.[3]
It means that is it will skip all not known elements of markup'.
The SGML SHORTTAG feature that is enabled for HTML is not an unknown
element of HTML markup. It is well specified[4] and documented, and
even partially supported by current implementations.[5]
is perfectly good - it is well 'understood' by common HTML parsers
If they do not understand it as "<img ...>&gt;", those are _not_ really
HTML parsers, but, as you tried to point out, "tag soup parsers".
and furthermore it is valid under XHTML.


As one of the major browsers (IE) still does not support XHTML, that
does not bear any meaning regarding the usefulness of that code. Take

<script type="text/javascript" src="foo.js" />

for example, which is perfectly Valid XHTML but will probably not work as
supposed in IE even if declared as such: first thing is that IE does not
support the proper media type for XHTML, application/xhtml+xml; second is
that if that markup is served with the media type text/html, the above is
probably parsed (due to the mentioned false error-correction) to the HTML
markup

<script type="text/javascript" src="foo.js">

The `script' element would be not closed, hence all following markup was
considered script code which would probably cause this content not to be
displayed and instead cause a SyntaxError in that UA.[6]

Those are well-known facts that have often (enough) been discussed here.[7]

See also <URL:http://hixie.ch/advocacy/xhtml>
PointedEars
___________
[1] <URL:http://www.w3.org/TR/REC-html32>
<URL:http://www.w3.org/TR/html4/>
<URL:https://www.cs.tcd.ie/15445/15445.html>
<URL:http://rfc-editor.org/rfc/rfc2854.txt>
[2] <URL:http://validator.w3.org/>
[3] <URL:http://diveintomark.org/archives/2003/05/05/why_we_wont_help_you>
[4] <URL:http://www.w3.org/TR/html4/sgml/sgmldecl.html>
[5] <URL:http://www.dodabo.de/html+css/tests/shorttag.html>
[6]
<URL:http://groups.google.com/group/comp.lang.javascript/msg/ec*******************************************@Poin tedEars.de>
[7]
<URL:http://groups.google.com/groups?as_q=XHTML&as_ugroup=comp.lang.javascript&s coring=d&filter=0>
Dec 11 '05 #8
"Luke Matuszewski" <ma****************@gmail.com> wrote:
This statement is wrong in my assumption. For HTML source code the
appropriate parser is called 'soap parser'.


Go wash your mouth with soap, please :-D.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Dec 11 '05 #9

Thomas 'PointedEars' Lahn napisal(a):
If they do not understand it as "<img ...>&gt;"
Ok, now i see the point.
As one of the major browsers (IE) still does not support XHTML,
And it will not support even in IE 7 (i have IE 7 beta 1 and it still
not supports major CSS 2 properties like min-width, furthermore
supported width property is treated by IE as min-width which is bad
thing :( ).
Take

<script type="text/javascript" src="foo.js" />

for example, which is perfectly Valid XHTML but will probably not work as
supposed in IE
Therefor i use

<script type="text/javascript" src="foo.js"></script>

construct, which will be treated well by IE.
<URL:http://www.w3.org/TR/REC-html40/interact/scripts.html#edef-SCRIPT>

[1] <URL:http://www.w3.org/TR/REC-html32>
[and many other links]


Thanks for many materials.

The solution for empty elements is to use the long form of it (when
writting HTML that will be valid XHTML 1.0) eg.

<img ...></img>

<URL:http://www.w3.org/TR/xhtml1/#guidelines>

Another thing is UAs with soup parsers, which may treat eg.

<br></br>

, as double <br> not one ! and it will be harmfull. Another thing is
inputs:

<input...></input>

I wonder how Konqueror will handle this empty elements...

Due to this restrictions, i turned to point where writting HTML as
valid XHTML isn't possible taking the different UAs implementations of
parsers.

Best regards.
Luke.

Dec 11 '05 #10
"Luke Matuszewski" <ma****************@gmail.com> wrote:
Due to this restrictions, i turned to point where writting HTML as
valid XHTML isn't possible taking the different UAs implementations of
parsers.


Why do you want to use XHTML?

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Dec 11 '05 #11

John Bokma napisal(a):

Why do you want to use XHTML?


I am currently working on large project, which will be maintained along
many years from now. Its interface is build using HTML 4.01 strict - by
appropriate doctype (to make it work as close as UA can get to w3c CSS
standards). Target browsers are IE, Gecko engine UAs, Opera, Konqueror.
In future probably it will be rewritten to XHTML for many reasons (as
many as XML is for), so it is wise to think over it now to avoid
unnecessary work in future.

Dec 11 '05 #12
"Luke Matuszewski" <ma****************@gmail.com> wrote:

John Bokma napisal(a):

Why do you want to use XHTML?

I am currently working on large project, which will be maintained along
many years from now. Its interface is build using HTML 4.01 strict - by
appropriate doctype (to make it work as close as UA can get to w3c CSS
standards). Target browsers are IE, Gecko engine UAs, Opera, Konqueror.
In future probably it will be rewritten to XHTML for many reasons (as
many as XML is for),


which reasons?

And why not just define it in XML and transform it to HTML 4.01 (see
below). You profit from both worlds :-D.
so it is wise to think over it now to avoid
unnecessary work in future.


Yup, I do the same. Hence my site (personal page) is defined (most of it)
in a few XML files, and a small perl script spits out HTML 4.01 strict.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Dec 11 '05 #13

John Bokma napisal(a):
"Luke Matuszewski" <ma****************@gmail.com> wrote:

John Bokma napisal(a):

Why do you want to use XHTML?

I am currently working on large project, which will be maintained along
many years from now. Its interface is build using HTML 4.01 strict - by
appropriate doctype (to make it work as close as UA can get to w3c CSS
standards). Target browsers are IE, Gecko engine UAs, Opera, Konqueror.
In future probably it will be rewritten to XHTML for many reasons (as
many as XML is for),


which reasons?


As many XML was designed for.
Yup, I do the same. Hence my site (personal page) is defined (most of it)
in a few XML files, and a small perl script spits out HTML 4.01 strict.


UI is generated via JSP pages, and we mainly write pages using custom
tags... it was a matter of decision (we have not considered Cocon or
other framework).

Dec 11 '05 #14
"Luke Matuszewski" <ma****************@gmail.com> wrote:

John Bokma napisal(a):
"Luke Matuszewski" <ma****************@gmail.com> wrote:
>
> John Bokma napisal(a):
>>
>> Why do you want to use XHTML?
>>
>
> I am currently working on large project, which will be maintained
> along many years from now. Its interface is build using HTML 4.01
> strict - by appropriate doctype (to make it work as close as UA can
> get to w3c CSS standards). Target browsers are IE, Gecko engine
> UAs, Opera, Konqueror. In future probably it will be rewritten to
> XHTML for many reasons (as many as XML is for),
which reasons?


As many XML was designed for.


Can you name them, or the 3 most important ones? (Since you seem to keep
avoiding the question).
Yup, I do the same. Hence my site (personal page) is defined (most of
it) in a few XML files, and a small perl script spits out HTML 4.01
strict.


UI is generated via JSP pages, and we mainly write pages using custom
tags...


Ah, but you still could control it via an XML template :-D.
it was a matter of decision (we have not considered Cocon or
other framework).


Uhm: so you just took JSP.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Dec 11 '05 #15
Luke Matuszewski wrote:
Thomas 'PointedEars' Lahn napisal(a):
If they do not understand it as "<img ...>&gt;"
Ok, now i see the point.


Grand, and would you please learn to mark omissions in cited material?
Take

<script type="text/javascript" src="foo.js" />

for example, which is perfectly Valid XHTML but will probably not work as
supposed in IE


Therefor i use

<script type="text/javascript" src="foo.js"></script>

construct, which will be treated well by IE.
<URL:http://www.w3.org/TR/REC-html40/interact/scripts.html#edef-SCRIPT>


And is described in Appendix C of the XHTML 1.0 Specification.
However, why would you want to use XHTML then? Just to "be cool"?
[1] <URL:http://www.w3.org/TR/REC-html32>
[and many other links]


Thanks for many materials.

The solution for empty elements is to use the long form of it (when
writting HTML that will be valid XHTML 1.0) eg.

<img ...></img>

<URL:http://www.w3.org/TR/xhtml1/#guidelines>


As I said and explained many times before, that HTML Compatibility
Guidelines of XHTML 1.0 Appendix C are nonsense. SGML applications
and XML applications cannot be made compatible. It "works" with using
optional close tags for HTML elements that have an empty content model,
but that is it.
[...]
Due to this restrictions, i turned to point where writting HTML as
valid XHTML isn't possible taking the different UAs implementations
of parsers.


Finally.
PointedEars
Dec 12 '05 #16
Luke Matuszewski wrote:
I am currently working on large project, which will be maintained along
many years from now. Its interface is build using HTML 4.01 strict - by
appropriate doctype (to make it work as close as UA can get to w3c CSS
standards). Target browsers are IE, Gecko engine UAs, Opera, Konqueror.
OK.
In future probably it will be rewritten to XHTML for many reasons (as
many as XML is for), so it is wise to think over it now to avoid
unnecessary work in future.


Nonsense. HTML will not expire because of XHTML, and converting HTML 4.01
Strict markup to XHTML 1.0 Strict markup is a matter of seconds.

It will rather expire because the Web as-we-know-it will, and then not even
XHTML will help you. ISTM that you are falling for nothing but a hype.
PointedEars
Dec 12 '05 #17
Thomas 'PointedEars' Lahn napisal(a):
[...] would you please learn to mark omissions in cited material?


Will try better.

Dec 12 '05 #18
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
Luke Matuszewski wrote:


[..]
In future probably it will be rewritten to XHTML for many reasons (as
many as XML is for), so it is wise to think over it now to avoid
unnecessary work in future.


Nonsense. HTML will not expire because of XHTML, and converting HTML
4.01 Strict markup to XHTML 1.0 Strict markup is a matter of seconds.


Yup, I am still curious for the reasons why XHTML has been chosen over
HTML.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Dec 12 '05 #19

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

Similar topics

20
by: Hanzo | last post by:
I'm iterating over a vector of base class pointers and deleting those which meet a certain criteria...i'm using pretty text-book code for the particular delete/erasure (it's straight out of Myers'...
1
by: Fuli Chang | last post by:
On a web page, when moving the cursor to an icon, button or a piece of text, a rectangle slot would automatically appear, in which some text is there explaining what the web page is about. For...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
0
by: Hrvoje Vrbanc | last post by:
Hello, this is a problem I came upon while building a site based on MCMS 2002 but it's not strictly MCMS-oriented: I have a page that displays a certain content in presentation mode but when an...
22
by: | last post by:
Hi I really hope that this posting is not a breach of netiquette. I keyed in some code copied from p.530 of The Complete Reference HTML Third Edition which is a popular book. I have listed it...
3
by: jonborbon | last post by:
Hi All! I have a form (form1.php) that displays the contents of a table, alongside each row is an icon to delete or edit that record. If I click on the 'delete' icon, the record number should be...
16
by: eholz1 | last post by:
Hello CSS group, I saw a beautiful effect that I would like to use either by CSS or using photoshop to create the image/effect (maybe even imagemagick) the site address is:...
3
by: jenn23 | last post by:
Alright so I have this script that was written by the person that I replaced and I need some help. There is a trash can icon that when you click on it is supposed to delete an image....
1
by: Jason7899 | last post by:
hi, i have seen some sites the have the photos with the effect that vista and mac does with the icons of the programs that is running, i have seen other cool effect that is the picture of the...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...
0
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...

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.