Wednesday, 19 April 2017

Javascript program to see even numbers using dropdown options.

Even Numbers using dropdown options.

<html>
<head>
<title> Even Numbers </title>
<script language="javascript">

function check()
{
var a=document.f1.low.value;
var b=document.f1.high.value;

if(a>b || a==b)
{
alert("Wrong Selection");
}
else
for(i=a;i<=b;i++)
{
if(i%2==0)
{
document.f1.ta1.value+=i+" ";
}
}
}

</script>
</head>

<body>
<form name="f1">

<b><font size=10>Even Numbers</font> </b>
 
<br><br><select name="low">
<option value="1">1</option>
<option value="10">10</option>
<option value="100">100</option>
<option value="1000">1000</option>
<option value="10000">10000</option>
</select>

<select name="high">
<option value="1">1</option>
<option value="10">10</option>
<option value="100">100</option>
<option value="1000">1000</option>
<option value="10000">10000</option>
</select><br>
<br><textArea name="ta1"rows=7 col=7 value=""></textArea><br>
<br><input type="Button" name="btn1"value="Check" onClick="check()">

</form>
</center>
</body>
</html>

Output:-





No comments:

Post a Comment

Popular Posts

Program of Counting Vowels and Consonants in Javascript

Solution:-  <html> <head><title>Count vowels and consonants</title> <script language="Javascript"...