0% found this document useful (0 votes)
4 views1 page

Count Vowels in JavaScript Input

Uploaded by

detic41818
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Count Vowels in JavaScript Input

Uploaded by

detic41818
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

index.

html

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function getVowels() {
var vowelsCount = 0;
var str = [Link]("t1").value;
var string = [Link]();
for (var i = 0; i <= [Link] - 1; i++) {
if ([Link](i) == "a" || [Link](i) == "e" || [Link](i) == "i" || [Link](i)
== "o" || [Link](i) == "u") {
vowelsCount += 1;
}
}
//[Link]("Total Vowels : "+vowelsCount);
[Link]('demo').innerHTML = "Total Vowels : "+vowelsCount;
return vowelsCount;
}
</script>
<tr>
<td><input type="text" id="t1"></td>
<td><input type="submit" name="submit" onclick="getVowels()"></td></tr>
<p id="demo"></p>
</body>
</html>

Output

You might also like