getScript Method
Returns a String that represents the script for an event for a specified element.
expression.getScript(element, event, index)
*expression * Required. An expression that returns one of the objects in the Applies To list.
element Required IHTMLElement. Specifies the element that contains the script.
event Required String. Specifies the name of the event that causes the script to run.
index Required Long. Specifies the script item if an event specifies more than one script to run when the event occurs. Multiple scripts are one-based rather than zero-based so that the index for the first script (in the case of multiple scripts) or the only script (in the case of a single script) for an event is "1".
Remarks
Use the addScript method to add a script to an element.
Example
The following example copies the script from the onmouseover event in the first paragraph of the active document and adds it to the onclick event for the body of the active document.
Dim objBody As FPHTMLBody
Dim objPara As FPHTMLParaElement
Dim strScript As String
Set objBody = ActiveDocument.body
Set objPara = ActiveDocument.all.tags("p").Item(0)
strScript = ActiveDocument.getScript(objPara, "onmouseover", 1)
ActiveDocument.addScript objBody, "onclick", "alert('hello!');"
Applies to | FPHTMLDocument Object | IFPDocument Object | IFPDocument Object