onmousedown 属性

       

返回或设置 Variant 类型的值,该值表示与 onmousedown 事件相关联的值。例如,Variant 可以代表当事件发生时执行的某个宏或过程调用。可读写。

expression.onmousedown

expression  必选。返回 DispFPHTMLDocument 对象的表达式。

示例

在以下示例中,当用户在当前网页中包含 onmousedown="DisplayMessage" 属性的 <p> 元素上按下鼠标按钮时,将向用户显示一条信息。此示例内嵌在 HTML 文档的 <head> 节中。

<head>
<title>onmousedown Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user depresses a mouse button over the <p> element in the current document."

End Sub

-->
</script>
</head>

以下 <p> 节代码调用位于文档的 <head> 节中的 DisplayMessage 过程;当用户在文档的 <p> 元素中按住鼠标按钮时,将显示一条消息。

<body>
<p onmousedown = "DisplayMessage">Move the mouse over this paragraph and depress a button to view a message.</p>
</body>

以下代码行将 onmousedown 属性设置为 DisplayMessage 过程调用。索引值零 (0) 表示 <p> 标志是当前网页中唯一的 <p> 元素,也是 all 集合中唯一的 <p> 元素。

ActiveDocument.body.all.tags("p").item(0).onmousedown = "Display Message"