Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] document.selection.clear()
- From: LaurentM at london.virgin.net (Laurent Muchacho)
- Subject: [Javascript] document.selection.clear()
- Date: Thu Sep 23 12:47:02 2004
Hi I found the solution to the problem I had this morning. I updated the file containing the examples http://www.be-lovely.co.uk/examples/img_edit/default.html and you can found the code below. I guess you guy can continue to worry about what ASCII codes are now. Regards Laurent <html> <head> <title>Untitled</title> <script language="JavaScript"> var objselected = null; function image_context_menu(obj){ objselected = obj; imgToolMenu.style.left = event.clientX; imgToolMenu.style.top = event.clientY; imgToolMenu.style.visibility = 'visible'; } function delete_img(){ if(objselected) { var r = document.body.createControlRange(); r.add(objselected); r.select(); objselected = null; imgToolMenu.style.visibility = 'hidden'; } document.selection.clear(); } </script> </head> <body> <div id="textEditor" contenteditable="true" style="position:absolute; left:20px; top:70px; width:400px; border: 1px solid black"> <IMG height="132" src="http://www.gainsford-studio.co.uk/images/homepage_1.jpg" width="209" align="left" border="0" name="horsey" id="horsey" oncontextmenu="image_context_menu(this);return false;">When right clicked this image will display a small menu with the option of deleting the image <br> <br> <br> <br> <hr> <br> <br> <IMG oncontextmenu="delete_img();return false;" height="132" src="http://www.gainsford-studio.co.uk/images/homepage_1.jpg" width="209" align="left">When right clicked this image will directly disapear </div> What I will like to do is be able to delete the graphics<br> from the small right click menu on the first picture but soon as you clicked on the delete option the selection disapear <div id="imgToolMenu" style="position:absolute; left:0px; top:0px; visibility:hidden; border: 1px solid black; background-color:#FFFFFF"><div onclick="delete_img();">delete</div></div> </body> </html> -----Original Message----- From: Laurent Muchacho [mailto:LaurentM@xxxxxxxxxxxxxxxxx] Sent: 23 September 2004 11:04 To: '[JavaScript List]' Subject: [Javascript] document.selection.clear() Hi I'm trying to built a small text editor for a content management system I'm building. The challenge I got is pretty simple in my editable area I got some graphics. On this graphics I did trigger the right click event(oncontextmenu) the image on the top is showing a small layer with the option to delete the picture but when I click on the delete option in my small menu I lose the selection on the graphics and can't delete it, the image on the bottom is directly calling a function to delete the current graphics. Please any help or link will be more then welcome. found the example below describing what my challenge is http://www.be-lovely.co.uk/examples/img_edit/default.html or their is the code <html> <head> <title>Untitled</title> <script language="JavaScript"> function image_context_menu(){ imgToolMenu.style.left = event.clientX; imgToolMenu.style.top = event.clientY; imgToolMenu.style.visibility = 'visible'; } function delete_img(){ document.selection.clear(); } </script> </head> <body> <div id="textEditor" contenteditable="true" style="position:absolute; left:20px; top:70px; width:400px; border: 1px solid black"> <IMG oncontextmenu="image_context_menu();return false;" height="132" src="http://www.gainsford-studio.co.uk/images/homepage_1.jpg" width="209" align="left">When right clicked this image will display a small menu with the option of deleting the image <br> <br> <br> <br> <hr> <br> <br> <IMG oncontextmenu="delete_img();return false;" height="132" src="http://www.gainsford-studio.co.uk/images/homepage_1.jpg" width="209" align="left">When right clicked this image will directly disapear </div> What I will like to do is be able to delete the graphics<br> from the small right click menu on the first picture but soon as you clicked on the delete option the selection disapear <div id="imgToolMenu" style="position:absolute; left:0px; top:0px; visibility:hidden; border: 1px solid black; background-color:#FFFFFF"><div onclick="delete_img()">delete</div></div> <br><br>This E-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this E-mail in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this E-mail.</body> </html> _______________________________________________ Javascript mailing list Javascript@xxxxxxxxxx https://lists.LaTech.edu/mailman/listinfo/javascript This E-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this E-mail in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this E-mail.
- Prev by Date: [Javascript] What is this
- Next by Date: [Javascript] Opening a Fullscreen Window
- Previous by thread: [Javascript] document.selection.clear()
- Next by thread: [Javascript] What is this
- Index(es):