atom://welcome/guidejs小练习

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:


推荐阅读更多精彩内容