Check out PHP. That language is designed to serve specific HTML stuff. Otherwise javascript applets can be run from HTML. C++ is meant to run at a lower-level. It interfaces directly with the OS and the processor.
Example:
You would write a web-browser in C++. Your web-browser interprets HTML. The HTML is dynamically arranged/served by PHP. One of the objects served may be a javascript applet. To run the applet, the web-browser would initialize and run a virtual machine designed to interpret java bytecode written in C++.
@ OP: What you're asking for is exactly what ActiveX was originally designed to accomplish. If your code is simplistic enough though, it would be much easier to port it to a more suitable language such as Java or, as mentioned, JS.