Like:-
a=1
e=1
i=1
o=1
u=1
Ans:-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function vowelCount()
{
var str = f1.t1.value;
var vowel = ['a', 'e', 'i', 'o', 'u'];
for (var i = 0; i < vowel.length; i++)
{
count = 0;
for (var j = 0; j < str.length; j++)
{
if (vowel[i] == str[j])
{
count++;
}
}
if(count!=0)
document.write(vowel[i] + '=' + count+"<br/>");
}
}
</script>
</head>
<body>
<form id="f1">
<div id="div1">
<fieldset style="width:30%;margin:auto;margin-top:20%;background:orange" align="center">
<legend>Input Area</legend>
<textarea placeholder="Enter any message.." id="t1" rows="10"></textarea><br />
<input type="button" onclick="vowelCount()" value="submit"/>
</fieldset>
</div>
</form>
</body>
</html>
a=1
e=1
i=1
o=1
u=1
Ans:-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function vowelCount()
{
var str = f1.t1.value;
var vowel = ['a', 'e', 'i', 'o', 'u'];
for (var i = 0; i < vowel.length; i++)
{
count = 0;
for (var j = 0; j < str.length; j++)
{
if (vowel[i] == str[j])
{
count++;
}
}
if(count!=0)
document.write(vowel[i] + '=' + count+"<br/>");
}
}
</script>
</head>
<body>
<form id="f1">
<div id="div1">
<fieldset style="width:30%;margin:auto;margin-top:20%;background:orange" align="center">
<legend>Input Area</legend>
<textarea placeholder="Enter any message.." id="t1" rows="10"></textarea><br />
<input type="button" onclick="vowelCount()" value="submit"/>
</fieldset>
</div>
</form>
</body>
</html>
No comments:
Post a Comment