共用方式為


FindBehavior method

Requests that the specified Dynamic HTML (DHTML) behavior be instantiated.

Syntax

HRESULT retVal = object.FindBehavior(bstrBehavior, bstrBehaviorUrl, pSite, ppBehavior);

Parameters

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

After the Dynamic HTML (DHTML) behavior is instantiated, MSHTML calls the IElementBehavior::Init method.

Specify the case of the bstrBehavior parameter to be all caps when you use this method with element behaviors; for attached behaviors, specify the bstrBehavior parameter in lowercase. Because the bstrBehavior parameter has a specific case based on the type of behavior, you must take precautions when this parameter is used in a string comparison: either the case of the string should be forced, or a case–insensitive comparison should be used.