Jump to content
xisto Community

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

Recommended Posts

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?

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.