Pr05_gugudan.js 444 Bytes

function selectEvent(selectObj) {
    gugudan(selectObj.value);
}

function gugudan(danIdx) {
    document.getElementById("subtitle").innerHTML = danIdx + "단";

    var txt = "";
    for (var j = 1; j <= 9; j++) {
        txt = txt +  danIdx + " * " + j + " = " + danIdx * j +"<br>";
    }
    document.getElementById("result").innerHTML = txt;
    
}

function deleteButtonClick() {
    document.getElementById("result").innerHTML = "";
}