The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Drag and Drop a row out of the table?, Drag and drop a row out of the table to be deleted
mkrwp
post Mar 8 2009, 04:19 PM
Post #1





Group: Members
Posts: 1
Joined: 8-March 09
Member No.: 8,012



I created a drag and drop functions for a smiley image.
It works fine but not if i put it in a row of a table
<tr></tr> or <tr><td> </td></tr>
I cannot drag it at all if it's put inside the table.
How can i get it to work when it's inside the table??? I am trying to figure out how to do a drag of a row out of a table and into a recycle bin image but have been unsuccessful so i am now trying to just give the appearance of it working by having an image inside the row and being able to drag it out of the table to a recycle bin and delete the row.

Here code wub.gif :


<html>
<head>
<style>
img
{
position:absolute;
}
</style>

<script type="text/javascript">
document.onmousedown=coordinates;
document.onmouseup=mouseup;

function coordinates(e)
{
if (e == null) { e = window.event;}
var sender = (typeof( window.event ) != "undefined" ) ? e.srcElement : e.target;

if (sender.id=="moveMe")
{
mouseover=true;
pleft=parseInt(movMeId.style.left);
ptop=parseInt(movMeId.style.top);
xcoor=e.clientX;
ycoor=e.clientY;
document.onmousemove=moveImage;
return false;
}
else { return false; }
}

function moveImage(e)
{
if (e == null) { e = window.event;}
movMeId.style.left=pleft+e.clientX-xco...
movMeId.style.top=ptop+e.clientY-ycoor...
return false;
}

function mouseup(e)
{
document.onmousemove=null;
}

</script>
</head>
<body>

<img id="moveMe2" src="smiley.gif" width="32" height="32" />
<p>Drag and drop the image</p>

<script type="text/javascript">
//The movable image
movMeId=document.getElementById("moveM...
//image starting location
movMeId.style.top="75px";
movMeId.style.left="75px";
</script>
<table id="myTable" border="1">
<tr>

<td>

<img id="moveMe" src="smiley.gif" width="32" height="32" />
Row1 cell1

</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
<tr>
<td>Row3 cell1</td>
<td>Row3 cell2</td>
</tr>
</table>

</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 06:34 PM