加入“工具”页面(未完成)
This commit is contained in:
16
docs/js/tool.js
Normal file
16
docs/js/tool.js
Normal file
@@ -0,0 +1,16 @@
|
||||
function toolCalculateSubmit() {
|
||||
getInput = document.getElementById("tool-calculate-input");
|
||||
getToFixed = document.getElementsByClassName("tool-calculate-tofixed")[0];
|
||||
getResult = document.getElementsByClassName("tool-calculate-result")[0].getElementsByTagName("span")[0];
|
||||
if (getToFixed.value >= 0 && getToFixed.value <= 16) {
|
||||
getResult.innerText = eval(getInput.value).toFixed(getToFixed.value);
|
||||
} else {
|
||||
getResult.innerText = "错误";
|
||||
}
|
||||
}
|
||||
|
||||
function toolCalculateClear() {
|
||||
getInput = document.getElementById("tool-calculate-input");
|
||||
getInput.value = '';
|
||||
getResult.innerText = '';
|
||||
}
|
Reference in New Issue
Block a user