CODE:-
<html>
<head>
<title>Palindrome</title>
<style type="text/css">
body{
background-color:lightgreen;
}
.v1{
text-align:center;
}
.tab{
background-color:lightblue;
text-transform:capitalize;
}
.v2{
text-align:center;
text-transform:capitalize;
background-color:lightgrey;
color:red;
}
</style>
<script type="text/javascript">
function check()
{
var no,i,temp,rem,rev=0;
no=parseInt(document.f1.no.value);
temp=no;
while(no>0)
{
rem=no%10;
no=parseInt(no/10);
rev=(rev*10)+rem;
}
if(rev==temp)
{
var an=["Yes"];
document.f1.ans.value=an;
}
else
{
var a=["No"];
document.f1.ans.value=a;
}
return false;
}
</script>
</head>
<body>
<center>
<form name="f1" method="post" onsubmit="return check()">
<table border="1" cellspacing="0" class="tab">
<tr class="v1">
<th colspan="2">to check palindrome of given number</th>
</tr>
<tr>
<th>enter number:-</th>
<td><input type="text" name="no" size="5" style="border-radius:10px;"></td>
</tr>
<tr class="v1">
<td colspan="2">
<input type="submit" name="submit" value="Submit" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">
<input type="reset" name="reset" value="Reset" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">
</td>
</tr>
<tr>
<th>given number:-</th>
<td><input type="text" name="ans" size="5" style="border-radius:10px;"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
No comments:
Post a Comment