怎样交一幅图片拖进表格中

怎样交一幅图片拖进表格中
---------------------------------------------------------------

 1<body>
 2<img id="s" onmousedown="did(this)" src="csdn.gif"/>
 3<script>   
 4var ms;   
 5function did(obj){   
 6ms=obj;   
 7event.srcElement.setCapture();   
 8}   
 9  
10function document.onmouseup(){   
11if(ms&&document.elementFromPoint(event.x,event.y).tagName=="TD"){   
12event.srcElement.releaseCapture();   
13document.elementFromPoint(event.x,event.y).appendChild(ms)   
14}   
15ms=null;   
16}   
17</script>
18<table border="1" width="100">
19<tr>
20<td width="50%"> </td>
21<td width="50%"> </td>
22</tr>
23<tr>
24<td width="50%"> </td>
25<td width="50%"> </td>
26</tr>
27</table></body>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus