atom://welcome/guidejs小练习
2017-06-06 本文已影响0人
葛高召
js 文件
function add() {
resMonthed(Number(firstNumber()) + Number(secondNumber()));
}
function subtruct() {
resMonthed(Number(firstNumber()) - Number(secondNumber()));
}
function ride() {
resMonthed(Number(firstNumber()) * Number(secondNumber()));
}
function devide() {
resMonthed(Number(firstNumber()) / Number(secondNumber()));
}
function resMonthed(res) {
return document.getElementById("result").innerHTML = res;
}
function firstNumber() {
return document.getElementById("first").value;
}
function secondNumber() {
return document.getElementById("seccond").value;
}
html: