Use the js effect multiple times in the same page?

dd();

function dd() {
    var s = document.getElementsByClassName("pingStar")[0],
        m = document.getElementsByClassName("dir")[0],
        n = s.getElementsByTagName("li"),
        input = document.getElementsByClassName("startP")[0]; //
    clearAll = function () {
        for (var i = 0; i < n.length; iPP) {
            n[i].className = "";
        }
    }
    for (var i = 0; i < n.length; iPP) {
        n[i].onclick = function () {
            var q = this.getAttribute("rel");
            clearAll();
            input.value = q;
            for (var i = 0; i < q; iPP) {
                n[i].className = "on";
            }
            m.innerHTML = this.getAttribute("title");
        }
        n[i].onmouseover = function () {
            var q = this.getAttribute("rel");
            clearAll();
            for (var i = 0; i < q; iPP) {
                n[i].className = "on";
            }
        }
        n[i].onmouseout = function () {
            clearAll();
            for (var i = 0; i < input.value; iPP) {
                n[i].className = "on";
            }
        }
    }
}

how can you use this code to achieve several such effects at the same time

in the same page?
Mar.11,2021

send in s, m, input with parameters?

function dd(s, m, input) {
  var n = s.getElementByTagName('li');
  // 
}
Menu