Комментарии:
Nothing a useful information in this video
Ответитьwhat if I wanted to count all the c's & r's? for example: let count_me = "cr"...
Ответитьsome explanation wouldn't have hurt anybody..
Ответить<!DOCTYPE html>
<html>
<body>
<form>
INPUT TEXT <input type = "text" id = "textbox1">
<br> <br>
Count <input type = "text" id = "textbox2">
<br><br>
TOTAL <input type = "text" id = "total">
<br><br>
<button type = "button" onclick = "gettext()"> bobo</button>
</form>
<script>
function gettext(){
var txt = document.getElementById("textbox1"),
count = 0;
for (var i = 0; i<txt.length; i++){
if(txt.charAt(i) === document.getElementById("textbox2")){
count++;
}
}
document.getElementById("total").value = count;
}
</script>
</body>
</html>
the output is 0 what do I do