Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Need Help With Javascript Drag And Drop Script, Having trouble with javascript drag and drop script.
minimcmonkey
post 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?

Go to the top of the page
 
+Quote Post
Nabb
post 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.
Go to the top of the page
 
+Quote Post
minimcmonkey
post 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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Java Script Drop Down Menu With Css(2)
  2. Javascript Slideshow Tutorial(7)
  3. [help] Java Script: Window.open(10)
  4. File Upload Script In Java(5)
  5. Javascript Close Window(15)
  6. One Click Copy And Paste To Clipboard(5)
  7. Adding Rows & Columns In Html Table Using Javascript(1)
  8. I'm Making My Own Javascript Only Rpg :d(7)
  9. What's The Relationship Between Javascript And Java(7)
  10. Javascript : No Right Click Script !@(12)
  11. Hiding <div> Boxes With Javascript(8)
  12. Problem With Java Script Popup Form(1)
  13. Web Applications: J2ee Or Javascript/css/html(1)
  14. Jsp Or Java Chat Script Like Mig33(5)
  15. I`m New To Javascript.(5)
  1. Lottery Script Help(5)
  2. Simple Firefox Vs. Ie Script Bug; Need A Little Help(3)
  3. Javascript Error(2)
  4. Is It Possible To Create A Web Based Mmo In Javascript?(4)
  5. Capturing Username Of Computer(3)
  6. Javascript Object Node Referencing Help(5)
  7. Flash And Javascript Interaction(1)
  8. Document.write & Noscript Questions (javascript)(2)
  9. Java Vs Javascript(11)
  10. Adjusting Rows/cols Of Frames In Frameset Using Javascript Is Not Working In Firefox 3 Is Not Working(4)
  11. Java Script To Hide The Url In Address Bar(6)
  12. Re-learning Javascript(3)
  13. Javascript Game(6)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 05:12 PM