Export (0) Print
Expand All

onmove event

Fires when the object moves.

Syntax

HTML Attribute <element onmove = "handler(event)">
Event Property object.onmove = handler;

Event information

SynchronousNo
BubblesNo
CancelableNo

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

There are no standards that apply here.

Remarks

This event can be bound to relatively positioned elements as well as absolutely positioned elements.

This event does not fire when it is bound to an object inside a container object that moves.

Calls the associated event handler if there is one.

To invoke this event, do one of the following:

  • Change the absolute position of the object.

Examples

The following example shows how to use the onmove event and display the x and y coordinates of a DIV as it is moved.


<html>
<head>
<title>The onmove event</title>
<script>
// Turn on 2-D positioning
document.execCommand("2D-position",false,true);
function fnHandleMove() {
  oXDelta.innerText = event.srcElement.offsetLeft;
  oYDelta.innerText = event.srcElement.offsetTop; 
}
</script>
</head>
<body onmove="fnHandleMove();">
<b>Current Object:</b><br>
X delta: <span id="oXDelta">n/a</span><br>
Y delta: <span id="oYDelta">n/a</span><br>
<div contenteditable="true">
<div style="width:300px;height:100px; background-color:red; position:absolute;">
Movable DIV</div>
</div>
</body>
</html>


See also

a
abbr
address
area
b
bdo
blockQuote
body
button
caption
cite
custom
dd
div
dl
dt
em
embed
fieldSet
form
hn
hr
i
iframe
img
input type=button
input type=checkbox
input type=file
input type=hidden
input type=image
input type=password
input type=radio
input type=reset
input type=submit
input type=text
ins
kbd
label
legend
li
object
ol
p
pre
q
rt
ruby
s
samp
select
small
span
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
tr
u
ul
var

 

 

Send comments about this topic to Microsoft

Build date: 11/14/2012

Show:
© 2014 Microsoft