<!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 f1() {
var arr = new Array();
var count = 0;
var multipleno = document.getElementById("txtMultipleNo").value;
var regxMultipleno = /^[1-9]$/;
var checkMultipleno = regxMultipleno.test(multipleno);
if (checkMultipleno == "" || checkMultipleno == null) {
alert("Enter only Nos..");
return false;
}
else {
alert("Entered Successfully");
}
var range = document.getElementById("txtRange").value;
var regxRange = /^[1-9][0-9]*$/;
var checkRange = regxRange.test(range);
if (checkRange == "" || checkRange == null) {
alert("Enter only Nos..");
return false;
}
else {
alert("Entered Successfully");
}
for (var i = 1; i <= range; i++) {
if ( i% multipleno == 0) {
arr[count] = i;
count++;
}
}
document.write("Multiple of " + multipleno + "'s are->");
for (var j = 0; j <= count-1; j++) {
document.write("<br/>" + arr[j]);
}
}
alert("hi");
</script>
</head>
<body>
Multilpe No : <input id="txtMultipleNo" type="text" />
<br/>
Range Upto : <input id="txtRange" type="text" />
<input id="btnSubmit" type="button" value="Submit" onclick="return f1()"/>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function f1() {
var arr = new Array();
var count = 0;
var multipleno = document.getElementById("txtMultipleNo").value;
var regxMultipleno = /^[1-9]$/;
var checkMultipleno = regxMultipleno.test(multipleno);
if (checkMultipleno == "" || checkMultipleno == null) {
alert("Enter only Nos..");
return false;
}
else {
alert("Entered Successfully");
}
var range = document.getElementById("txtRange").value;
var regxRange = /^[1-9][0-9]*$/;
var checkRange = regxRange.test(range);
if (checkRange == "" || checkRange == null) {
alert("Enter only Nos..");
return false;
}
else {
alert("Entered Successfully");
}
for (var i = 1; i <= range; i++) {
if ( i% multipleno == 0) {
arr[count] = i;
count++;
}
}
document.write("Multiple of " + multipleno + "'s are->");
for (var j = 0; j <= count-1; j++) {
document.write("<br/>" + arr[j]);
}
}
alert("hi");
</script>
</head>
<body>
Multilpe No : <input id="txtMultipleNo" type="text" />
<br/>
Range Upto : <input id="txtRange" type="text" />
<input id="btnSubmit" type="button" value="Submit" onclick="return f1()"/>
</body>
</html>
No comments:
Post a Comment