HOME       >>       Programming

Seeking Help With Javascript Need help with drag and drop type script


minimcmonkey

What i want to make is a script that has a table, which is a menu for my site, and when you click the top of the table you can drag it to another place in the page. This is the code:

<html><head><title>Test run - Right click menu - ©Jack McCrea 2008</title><script type="text/javascript">function coordinates(event){if (event.button==2) { var x=event.x;var y=event.y;document.getElementById("element").style.left=x;document.getElementById("element").style.top=y;document.getElementById("element").style.visibility="visible";var oldx=x;var oldy=y;}}</script><script type="text/javascript">function coordinatesb(event){var oldx=x;var oldy=y;var newx=event.x;var newy=eveny.y;var difx=oldx-newx;var dify=oldy-newy;var newposx=oldx-difx;var newposy=oldy-dify;var oldx=newposx;var oldy=newposy;document.getElementById("element").style.left=oldx;document.getElementById("element").style.top=oldy;window.onmouseup=end();window.onmousemove=coordinatesb(event);}function end(){}</script> <style type="text/CSS">#element { position: absolute; top: 0px; left: 0px; background-color: 568934; border: 3px dashed; visibility: hidden; z-index: 1;}</style></head><body bgcolor="112233" onmousedown="coordinates(event)" oncontextmenu="return false;"><div id="element">hi<br><table><tr><th onmousedown="coordinatesb(event)">hi</th></tr></table>hi<br>hi<br>hi<br>hi<br>hi<br>hi<br></div> </body></html>

this doesnt seem to work. any ideas?


jlhaslip

Check this out: https://www.google.ca/search?hl=en&q=jaearch&meta=

Zorn does a good job as far as I know. Only thing I don't know about is whether it will work along side your right click menu script.
I suggest you install each of the scripts seperately on their own page and get them working independently before blending them into the same page.



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.