How to modify this registration box?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script type="text/javascript">
var startat=5;
function disableRegBtn(bdisable){
        document.getElementById("regBtn").disabled=bdisable;
}
 
function showTime(){
    if(startat==0){
        clearInterval(timeId);
        document.getElementById("p1").innerHTML="";
        disableRegBtn(true);
        return;
        }
    document.getElementById("p1").innerHTML=startat + "";
    startat--;      
}
window.onload=function(){
    document.getElementById("taid").readOnly=true;
    disableRegBtn(true);
    timeId=setInterval("showTime()",1000);
}
</script>
<textarea id="taid" cols="30" rows="5">:
1.
2.
3.
</textarea> <p id="p1"><input id="regBtn" type="button" value="" />

</body> </html>

countdown, after 5 4 3 2 1, it shows "can register now"

but

<input id="regBtn" type="button" value="" />

cannot be displayed. The disableRegBtn (true);
in the
showTime function cannot be written as
disableRegBtn (fasle);
disableRegBtn ("disabled");

Oct.16,2021

you directly change the content of the p tag and overwrite the input tag inside. It is recommended to change it this way.
and there is a mistake in canceling the assignment of disabled. It should be false.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title></title>
</head>

<body>
    <script type="text/javascript">
        var startat = 5;

        function disableRegBtn(bdisable) {
            document.getElementById('regBtn').disabled = bdisable;
        }

        function showTime() {
            if (startat == 0) {
                clearInterval(timeId);
                document.getElementById("tip").innerHTML = "";
                disableRegBtn(false);
                return;
            }
            document.getElementById("tip").innerHTML = startat + "";
            startat--;
        }
        window.onload = function () {
            document.getElementById('taid').readOnly = true;
            disableRegBtn(true);
            timeId = setInterval("showTime()", 1000);
        }
    </script>
    <textarea id="taid" cols="30" rows="5">:
        1.
        2.
        3.
    </textarea>
    <p id="p1">
        <div id="tip"></div>
        <input id="regBtn" type="button" value="" />
    

</body> </html>

is very simple, because your code document.getElementById ("p1"). InnerHTML= "can now register" ; simply replace all the elements in your p tag, and naturally your buttons will be gone.
solution:

  1. write the button separately from the p tag, so that when you insert content directly into the dom node, your button will not be replaced.
  2. Instead of using the attribute innerHTML ,
  3. inserts a new dom node
  4. into the p tag instead.

above.

Menu