Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program to check whether a given number is a
palindrome or not?

Answer Posted / upendar

This Script checks the given number as well as string is palindrome or not


<html>
<body>
<script type="text/javascript">
function checkPalindrome() {
var revStr = "";
var str = document.getElementById("str").value;
var i = str.length;
for(var j=i; j>=0; j--) {
revStr = revStr+str.charAt(j);
}
if(str == revStr) {
alert(str+" -is Palindrome");
} else {
alert(str+" -is not a Palindrome");
}
}
</script>
<form >
Enter a String/Number: <input type="text" id="str" name="string" /><br />
<input type="submit" value="Check" onclick="checkPalindrome();"/>
</form>
</body>
</html>

Is This Answer Correct ?    437 Yes 107 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are there any training Institutions on iphone Automation testing?

2291


Is it possible to break javascript code into several lines?

1540


What is the best free ide?

919


What is difference between undefined variable and undeclared variable?

931


How to calculate fibonacci numbers in javascript?

1011


Define unescape() and escape() functions?

954


What does the term sticky session mean in a web-farm scenario?

965


What is the difference between arrow function and normal function?

1008


How do you change the style/class on any element using javascript?

914


Is javascript event driven?

913


How to add buttons in javascript?

862


Is a hash table an array?

959


Explain function hoisting in javascript?

889


Is javascript client side or server side?

923


How dhtml is used in javascript?

981