onbeforeupdate 属性

       

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

expression.onbeforeupdate

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

示例

以下示例在当前页面更新之前,向用户显示一条消息。此示例内嵌在 HTML 文档的 <head> 节中。

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

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user updates the document."

End Sub

-->
</script>
</head>

以下 <p> 节代码调用位于文档的 <head> 节中的 DisplayMessage 过程;当更新文档时,将显示消息。

<body>
<p onbeforeupdate = "DisplayMessage"></p>
</body>

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

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