0
我希望能够使用Math.js
和一个输入框将给定数量的用户转换为网站上的另一个数量,但无论我尝试何种方式都无法从用户输入输入框标记为“转换”并更改它。我怎么能做到这一点?如何让用户输入Math.js
<!DOCTYPE html>
<html>
<head>
<title>Convert</title>
<script type="text/javascript" src="https://raw.github.com/josdejong/mathjs/master/dist/math.js"></script>
</head>
<body>
<input type="text" id="convert"></input>
<script>
function print(value) {
document.write(math.format(value) + '<br>');
}
print(math.eval('"TEXT IN CONVERT BOX HERE" inch in cm'));
</script>
</body>
</html>
你能否解释一下你的问题的工作示例。 – Sasidharan