I've two separate HTML file and .js file. I have a calculate method which return the result in the javascript file.
我有兩個單獨的HTML文件和.js文件。我有一個計算方法,它返回javascript文件中的結果。
My question is how to set a textbox value from a javascript return value. Or at least from a separate javascript file. Initially I tried below which doesn't work as javascript and html are separated.
我的問題是如何從javascript返回值設置文本框值。或至少從單獨的javascript文件。最初我嘗試下面的功能不起作用,因為javascript和html是分開的。
function Calculate(ch)
{
//...
document.getElementById('Input').value = resultValue;
}
Thanks!
謝謝!
3 个解决方案
#1
2
eval is the soution for my problem. Input.value = eval(Calculate(ch))
eval是我問題的源泉。 Input.value = eval(Calculate(ch))
#2
0
try to define the js-file in the bottom of your html-file (near the