I am trying to call a method in a javascript class when a button is clicked. My test program is below. I've tried a number of things based on what I've found on the internet, but I can't get it to work. I would appreciate any help you can give me. Thanks.
<!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <script>
function Circuit(){ // class Circuit
function run(){ // method run
alert("running");
};
}
var circuit = new Circuit();
function runCircuit(){
circuit.run();
}
</script> <input type="button" onclick="runCircuit();" value="Click"/> </body> </html>