|
|
|
|
![]() ![]() |
Aug 20 2008, 10:17 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 301 Joined: 19-June 08 From: United Kingdom - Cornwall!!!!! Member No.: 63,876 myCENT:94.98 |
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: 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? |
|
|
|
Aug 20 2008, 11:52 PM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 4,300 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() myCENT:46.50 |
Check this out: http://www.google.ca/search?hl=en&q=ja...earch&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. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 03:28 AM |