subsection contents

Palindrome Tester

Enter a string:

What is a palindrome? A palindrome is a word or phrase which reads the same forward or backward. Here are some examples: "radar", "Abba", "Madam, I'm Adam"

This little JavaScript application let's you type in a phrase and then analyzes it to see if it is a palindrome. Spaces and some punctuation marks are ignored, as are differences in case. Therefore, "A man, a plan, a canal: Panama" is a valid palindrome.

Just type a phrase in the 'Input' area, then click on the 'Test for Palindrome' button. The verdict will be displayed below the button.

Tested with Safari, Firefox and Opera on Mac OS X. According to Browsershots, the page loads and appears to work with Internet Explorer (versions 5.5 to 8.0), Firefox, Opera, Chrome and Safari on Windows.

This page now accepts parameters passed in via the URL. Two URL formats are supported:
1. Palindrome.html?s=value - e.g. Palindrome.html?s=Madam
2. Palindrome.html?value to test - e.g. Palindrome.html?Madam, I'm Adam

Some more example palindromes:

  • "Able was I ere I saw Elba"
  • "Pa made Ed a map"
  • "kayak", "Ada", "Glenelg" (a suburb in Adelaide)
  • the trivial cases of a blank, a single character, or a string of identical characters

Go back to the Top

Palindrome Tester - No Layers Version

The result of the palindrome test will be displayed in an alert box when you click on 'Test for Palindrome'.

Enter a string:

Go back to the Top

Palindrome Tester - Dialog Box Version

For the Dialog Box version <- click link.

Go back to the Top

Last updated: April 1, 2009