Sunday, 24 April 2016

Create A HTML WebPage Using JAVASCRIPT For Check Given String In Palindrome Or Not

What Is PalinDrome

A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. Allowances may be made for adjustments to capital letters, punctuation, and word dividers. Examples in English include "A man, a plan, a canal, Panama!", "Amor, Roma", "race car", "stack cats", "step on no pets", "taco cat", "put it up", "Was it a car or a cat I saw?" and "No 'x' in Nixon".

Code Start Here


<html>

<head>
<meta charset = "UTF-8">
<title>Palindrome</title>
<style type="text/css">
body
{
font:10px sans-serif;
}
</style>
<script type="text/javascript">
function palindrome()
{
var initial = prompt("Please enter a 5 digit string to check whether it is a palindrome:", ""); 
var palin = new Array(); 

while (initial.length != 5)
{
alert("You did not enter a 5 character digit! All palindromes that this calculator can solve are 5 digits!")
initial = prompt("Please enter a 5 digit string to check whether it is a palindrome:", "");

for (var i = 0; i <= initial.length -1; i++) { 
palin[i] = initial.charAt(i); 
};


if (palin[0] == palin[4]) 

if (palin[1] == palin[3])  
{
document.write("The number that you entered was " + initial + ".");
document.write("<br>This number is a palindrome!")
}
}
else 
{
document.write("The number that you entered was " + initial + ".");
document.write("<br>This number is NOT a palindrome!")
};
}; 
</script>
</head>
<body align="center" bgcolor="aqua">

<p><h2> Enter a 5 digit string to check whether an the string is a palindrome.</p></h2><br>
<p><h2> A palindrome is a number that reads the same backwards and forwards. </h2></p1>
<hr> 
<input type = "button" id = "palindrome" value = "Click to start the program"  onclick = "palindrome();" />
</body>

</html>

Output:-


Number Is Palindrome Example 



www.programmingwithbasics.com

www.programmingwithbasics.com

www.programmingwithbasics.com

Number Is Not Palindrome Example 

www.programmingwithbasics.com

www.programmingwithbasics.com


Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment