The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Fires when the object moves.
Syntax
| HTML Attribute | <element onmove = "handler(event)"> |
|---|---|
| Event Property | object.onmove = handler; |
| attachEvent Method | object.attachEvent("onmove", handler) |
| addEventListener Method | object.addEventListener("move", handler, useCapture) |
Event information
| Synchronous | No |
|---|---|
| Bubbles | No |
| Cancelable | No |
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.
The pEvtObj parameter is required for the following interfaces:
- HTMLAnchorEvents2
- HTMLAreaEvents2
- HTMLButtonElementEvents2
- HTMLControlElementEvents2
- HTMLDocumentEvents2
- HTMLElementEvents2
- HTMLFormElementEvents2
- HTMLImgEvents2
- HTMLFrameSiteEvents2
- HTMLInputFileElementEvents2
- HTMLInputImageEvents2
- HTMLInputTextElementEvents2
- HTMLLabelEvents2
- HTMLLinkElementEvents2
- HTMLMapEvents2
- HTMLMarqueeElementEvents2
- HTMLObjectElementEvents2
- HTMLOptionButtonElementEvents2
- HTMLScriptEvents2
- HTMLSelectElementEvents2
- HTMLStyleElementEvents2
- HTMLTableEvents2
- HTMLTextContainerEvents2
- HTMLWindowEvents2
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.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onmoveEx1.htm
<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
- acronym
- address
- applet
- area
- b
- bdo
- big
- blockQuote
- body
- button
- caption
- center
- cite
- custom
- dd
- dfn
- dir
- div
- dl
- dt
- em
- embed
- fieldSet
- font
- form
- frame
- frameSet
- 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
- isIndex
- kbd
- label
- legend
- li
- listing
- marquee
- menu
- object
- ol
- p
- plainText
- pre
- q
- rt
- ruby
- s
- samp
- select
- small
- span
- strike
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- tr
- tt
- u
- ul
- var
- xmp
Send comments about this topic to Microsoft
Build date: 12/5/2012