Why do not my codes work in the "Html" tool? I tried changing it in "Type" but without success.
I am trying to use for example:
Code: Select all
<label id="seconds">10</label>
I'm trying to use the script below but it's not right. I tested it on the site https://www.w3schools.com/html/tryit.as ... html_intro and it works perfectly:
Code: Select all
<label id="seconds">10
<script>
var secondsLabel = document.getElementById("seconds");
var totalSeconds = 0;
setInterval(setTime, 1000);
function setTime() {
if (pad(totalSeconds % 60) == 1){
secondsLabel.innerHTML = "Ok";
return false;
}else {
++totalSeconds;
secondsLabel.innerHTML = pad(totalSeconds % 60);
}
}
function pad(val) {
var valString = val + "";
if (valString.length < 2) {
return "10" - valString;
} else {
return valString;
}
}
</script>