Home >Web Front-end >JS Tutorial >JS implementation of event response example of OCX control_javascript skills
JS supports the events of the OCX control. When the event defined by the OCX control occurs, JS can capture the event and handle the event accordingly.
Personally understood, it is actually who will complete the event response. The OCX control itself can definitely be implemented. The mechanism provided by JS allows JS to also complete the response to the OCX control event.
A simple example is as follows:
First add custom events in the OCX control (the same applies to predefined events, such as mouse clicks, etc. I haven’t tried it myself, but the principle should be the same),
The event should belong to the window, so right-click on the Ctrl class, Add->Add Event, as shown below:
Enter the event name in the opened dialog box, such as OnChange. If parameters are required, set the parameter information and click [Finish]. The wizard will automatically generate the code, as follows
The next step is the response to the event in JS, the code is as follows,