|
|
|
|
![]() ![]() |
Sep 27 2008, 04:56 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 301 Joined: 19-June 08 From: United Kingdom - Cornwall!!!!! Member No.: 63,876 myCENT:94.98 |
hi, i have been trying to create a drag and drop menu for my new website, so that the navigation menu can be moved around the site. This is the code i have:
CODE <html> <head> <title>Test run - Right click menu</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; window.onmouseup=end(); window.onmousemove=coordinates(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> When i run this (in Internet Explorer) it says "out of memory at line 8" and there are errors at lines 14 an 51, when i remove line 14, the error is seen on line 15 instead (because they do virtually the same thing) At the moment, i havent made it work in firefox or any other browsers, and dont intend to until it works with IE. I am aware that it doesnt account for scrolling, but im adding all that stuff later. Can anyone help? I have tried using a javascript debugger, and syntax chgecker, ect, but i still can fix it... any ideas? |
|
|
|
Sep 27 2008, 05:30 PM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 140 Joined: 24-July 08 From: Australia Member No.: 65,436 myCENT:33.96 |
On line uh... 52... you wrote coordinatesb instead of coordinates.
Not quite sure and I don't feel like debugging at the moment, but try using variable names that aren't x and y, that might be causing a problem. |
|
|
|
Sep 30 2008, 01:08 PM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 301 Joined: 19-June 08 From: United Kingdom - Cornwall!!!!! Member No.: 63,876 myCENT:94.98 |
I will try that, although i did build this using part of the code i used when i made a right click menu script, and the X and Y named variables worked fine then.
thanks, ill give that a go. I did try using a variable debugger, but i didnt get any errors. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 05:12 PM |