Template:我的模板
From 2008.igem.org
(Difference between revisions)
ZhangHaoran (Talk | contribs) (New page: 111111111111122222222222222222111111) |
ZhangHaoran (Talk | contribs) |
||
Line 1: | Line 1: | ||
- | + | <html> | |
+ | <div style="width:140px; height:140px; background-color:pink; cursor:pointer;" id="divBlock" onMouseDown="divBlock_event_mousedown(arguments[0]);"><img src="https://static.igem.org/mediawiki/2008/0/01/Tjumainpage.jpg" width="465" height="141"></div> | ||
+ | <script> | ||
+ | function divBlock_event_mousedown(e){ | ||
+ | var e, obj, temp; | ||
+ | obj=document.getElementById("divBlock"); | ||
+ | e=window.event?window.event:e; | ||
+ | obj.startX=e.clientX-obj.offsetLeft; | ||
+ | obj.startY=e.clientY-obj.offsetTop; | ||
+ | document.onmousemove=document_event_mousemove; | ||
+ | temp=document.attachEvent?document.attachEvent("onmouseup",document_event_mouseup):document.addEventListener("mouseup",document_event_mouseup,""); | ||
+ | } | ||
+ | function document_event_mousemove(e){ | ||
+ | var e, obj; | ||
+ | obj=document.getElementById("divBlock"); | ||
+ | e=window.event?window.event:e; | ||
+ | with(obj.style){ | ||
+ | position="absolute"; | ||
+ | left=e.clientX-obj.startX+"px"; | ||
+ | top=e.clientY-obj.startY+"px"; | ||
+ | } | ||
+ | } | ||
+ | function document_event_mouseup(e){ | ||
+ | var temp; | ||
+ | document.onmousemove=""; | ||
+ | temp=document.detachEvent?document.detachEvent("onmouseup",document_event_mouseup):document.removeEventListener("mouseup",document_event_mouseup,""); | ||
+ | } | ||
+ | </script> | ||
+ | |||
+ | </body> | ||
+ | </html> |
Revision as of 03:20, 18 October 2008