Set the value of the HTML text field from the return value of the Javascript function

I have two separate HTML and .js files. I have a calculation method that returns the result in a javascript file.

My question is how to set the value of a text field from a javascript return value. Or at least from a separate javascript file. I originally tried below, which does not work, since javascript and html are separate.

function Calculate(ch) 
{
    //...
    document.getElementById('Input').value = resultValue;
}

Thank!

+3
source share
3 answers

eval is soution for my problem. Input.value = eval (Calculate (ch))

+2
source

js html ( </body> ). , . .

0

Access textarea content using a property innerHTML, not a property value.

function Calculate(ch)  {
    //...
    document.getElementById('Input').innerHTML = resultValue;
}
0
source

All Articles