movestart | onmovestart event
Fires when the object starts to move.
Syntax
| HTML Attribute | <element onmovestart = "handler(event)"> |
|---|---|
| Event Property | object.onmovestart = handler; |
| attachEvent Method | object.attachEvent("onmovestart", handler) |
| addEventListener Method | object.addEventListener("movestart", handler, useCapture) |
Event information
| Synchronous | No |
|---|---|
| Bubbles | Yes |
| Cancelable | Yes |
Event handler parameters
- pEvtObj [in]
-
Type: IHTMLEventObj
Standards information
There are no standards that apply here.
Remarks
The onmovestart event fires only when an editable element starts to move.
This event can only be bound to absolutely positioned elements.
Calls the associated event handler if there is one.
To invoke this event, do one of the following:
- Start to move the editable 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 onmovestart event with a movable DIV and have the background color and inner text change when the DIV starts to move.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onmovestartendEx1.htm
<!DOCTYPE html> <html> <head> <title>Editing events sample page</title> <script> // Turn on 2D positioning document.execCommand("2D-position",false,true); // Fires when the onmovestart event is fired function fnHandleMoveStart() { var oDiv = event.srcElement oDiv.style.backgroundColor = "green"; oDiv.innerText = "I Started Moving"; } // Function called when the onmoveend event is fired function fnHandleMoveEnd() { var oDiv = event.srcElement oDiv.style.backgroundColor = "red"; oDiv.innerText = "I Stopped"; } </script> </head> <body onmovestart="fnHandleMoveStart();" onmoveend="fnHandleMoveEnd();"> <div contenteditable="true"> <div style="width:300px;height:100px; color:white; background-color:red; position:absolute;"> My 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=email
- input type=file
- input type=hidden
- input type=image
- input type=number
- input type=password
- input type=radio
- input type=range
- input type=reset
- input type=search
- input type=submit
- input type=tel
- input type=text
- input type=url
- 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