Slip 7 - A) Write a java script program to accept a string from user and display the count of vowel characters from that string.

Solution:

<html>

<head>

<script>

function PQR()

{

var str = document.getElementById('a').value;

var count = 0;

for (var i = 0; i < str.length; i++)

{

if (str.charAt(i).match(/[aeiouAEIOU]/))

{

count++;

}

}

alert(count);

}

</script>

</head>

<body>

Enter Text   : <input  id='a'> </br></br>

<button onclick="PQR()">click</button>

</body>

</html>

Post a Comment

0 Comments