Untitled

 avatar
unknown
javascript
3 years ago
803 B
6
Indexable
function vendorBoard(ymax, xmax) {
    let gameBoard = document.getElementById("gameBoard");
    for (let j = 0; j < ymax; j++) {
        let rowDiv = document.createElement("div");
        rowDiv.setAttribute("class", "row d-flex gap-3");
        rowDiv.setAttribute("id", "boardRow" + j);

        for (let i = 0; i < xmax; i++) {
            let colDiv = document.createElement("div");
            colDiv.setAttribute("class", "textBox");
            colDiv.setAttribute("id", "no" + (j * xmax + i));
            rowDiv.appendChild(colDiv)

            let span = document.createElement("span");
            span.setAttribute("class", "fs3");
            span.setAttribute("id", "noWord" + (j * xmax + i));
            colDiv.appendChild(span)
        }
        gameBoard.appendChild(rowDiv);
    }
}
Editor is loading...