0

I am totally new to JS (as such I use C and python) and I have been given a JS file for which I would like to create an onclick event for.

So, I took this on as a learning exercise, and I was confronted with something like this:

new ModeDetect,
QuasiNewton.prototype = {
    width: 1024,
    height: 768,
    top: 0,
    left: 0,
    showQuasiNewton: function(a) {
//more stuff here..
    },

The aim is to use something like this in html, to call showQuasiNewton:

<a href="#" onclick="showQuasiNewton()">Display simulation results</a>

The above obviously does not work - since the JS seems to have a constructor and a prototype and I was wondering how I could call the function showQuasiNewton

Any help would be greatly appreciated - I have no clue on JS.. :(

AJW
  • 5,569
  • 10
  • 44
  • 57
  • create an object of QuasiNewton() and add an on click event listener to the anchor tag. – Niladri Jan 21 '18 at 11:23
  • can you post your js file code here? very difficult to tell from the few lines given – Niladri Jan 21 '18 at 11:24
  • hope [how does javascript prototype work](https://stackoverflow.com/questions/572897/how-does-javascript-prototype-work?rq=1) and [javascript prototype dynamically add div onclick](https://stackoverflow.com/questions/22034243/using-javascript-prototype-need-to-dynamically-add-div-onclick) help – Roshna Omer Jan 21 '18 at 11:26

0 Answers0