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

What is the microsoft version of javascript?

970


What does the isNaN() function?

896


Are there any iphone Institutes which also train iphone automation testing in Hyderabad?

1950


How long does it take to learn javascript?

875


Difference between the substr() and substring() in JavaScript?

984


TypeError: document.getelementbyid(...) is null?

896


How do you implement Ajax using hide() function in JQuery?

2203


How do I enable cookies safari?

850


Which built-in method removes the last element from an array and returns that element?

856


How to show progress bar while loading using ajax call?

981


Name some of the JavaScript features?

1025


What is js full form?

889


What is NaN?

979


What are exports & imports?

885


Is function a data type in javascript?

943