Monday, 15 September 2014

Cant get my javascript function? -


I have this simple format function:

  function form (x, y): {Var handler = function (e) {document.getElementById (x) .innerHTML = number (this.value * 100) .toLocaleString () + "Centimes"; }; Document.getElementById (y) .onchange = Handler; Document.getElementById (y) .onkeyup = Handler; }   

and named it formatter.js

Now, I try to use it on an HTML page, it starts Loading:

  & lt; Script src = "path / to / formatter.js" & gt; & Lt; / Script & gt;   

It loads properly! But when I put it:

  & lt; Input id = "value" & gt; & Lt; Script & gt; Form ("HHH", "Value"); & Lt; / Script & gt; & Lt; H1 id = "hhh" & gt; & Lt; / H1>   

The console says that form is not defined!

Y) {...} // or forma = function (x, y) {. ..}

should work fine

No comments:

Post a Comment