Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Seeking Help With Javascript, Need help with drag and drop type script
minimcmonkey
post 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?


Go to the top of the page
 
+Quote Post
jlhaslip
post 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 Icon

Group: [MODERATOR]
Posts: 4,301
Joined: 24-July 05
From: Linix, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol
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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Need Script Please(4)
  2. Error In Purchased Script(9)
  3. How Do I Script A Tutorial Submit Site(3)
  4. Playing Flash Movies Without The One-click Activation: Simple Insertion Of Javascript(5)
  5. Swf Cd Help Needed Please(1)
  6. Looking For Phpbb Script(2)
  7. How Can I Make An Auto-updating Shoutbox Type Script?(4)
  8. Ajax - A New Technology(10)
  9. Lightbox Script Variations(0)
  10. Streaming Video Capture On Linux(2)
  11. Download Script(5)
  12. Browser Compatibility Problem With Firefox - Javascript + Css(3)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 08:40 PM