<!DOCTYPE html>
<html>
<body>
<h2> Read a character and check whether it is a Vowel or not. </h2>
<table border="2px">
<tr>
<th>Enter character: </th>
<td><input type="text" name="txt_string" id="charecter" maxlength="1" size="1"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="click me" onclick="findVowel()"/></td>
</tr>
</table>
<script language="JavaScript">
function findVowel() {
var ch = document.getElementById("charecter").value;
if(ch=="A" || ch=="E" || ch=="I" || ch=="O" || ch=="U" || ch=="a" || ch=="e" || ch=="i" || ch=="o" || ch=="u")
{
alert("You have entered: "+ch+" "+"is VOWEL");
}
else {
alert("You have entered: "+ch+" "+"is not VOWEL");
}
}
</script>
</body>
</html>
No comments:
Post a Comment