Help Plzzzz!!!!!!!!!!!!!!!!!!!...
> A palindrome is a number or a text phrase that reads the same backward and forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554 and 11611.
> ,mvcxmzxWrite a script that reads in a five-digit integer and determines whether it is a palindrome. If the number is not five digits long or is not a valid number, output XHTML text that displays an
> alert dialog indicating the problem to the user. Allow the user to enter a new value after dismissing the alert dialog. Continue the whole process until the user enters “stop”.
var startNumber = parseInt(12345/10000)
var endNumber = 12345%10
var remainNumber = parseIn((12345-startNumber*10000)/10)
> This is not a Homework at all.
> plzz in Java script.
> Hellllllllllllllllllllllllllllp

Member Avatar for GreenDay2001

This is not a Homework at all.

.....but it seems to be....not real life problems!!!

Post whatever you have done till now...and we'll help you. Solving all these would would be like completing your homework even if isn't.

Dear all

how to do it using Script Prompt, saying Enter a 5-digit integer or "stop" to stop the program
and in Html page

I want to put the number + is a palindrome and if user start with (0) like (01210) then Alert box say 01210 is not vald please enter a 5-digit number (not starting with 0) or "stop" to stop

Here is what I did so far but I failed to get to the above result

<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"">


<html xmlns = "">
<head>
<title></title>


<script type = "text/javascript">



function testNumber(errMsg) {


var trgtVal = /^\d{5}$/;
var promptMsg = (errMsg == 'error') ? 'Error!\nEnter a 5-digit integer or \'stop\' to stop the program' : 'Enter a 5-digit integer or \'stop\' to stop the program';


var reply = prompt(promptMsg,'')


var is5digitNo = (reply.search(trgtVal) != -1);
var is1sameas5 = (reply.charAt(0) == reply.charAt(4));
var is2is1sameas4 = (reply.charAt(1) == reply.charAt(3));


if (is1sameas5 && is2is1sameas4 && is5digitNo) {
alert(is1sameas5 && is2is1sameas4 && is5digitNo);
} else if (reply == 'stop') {
alert('Test stopped');
} else {
testNumber('error');
}


}


window.onload = testNumber;



</script>
</head>
<body>


<p>Click Refresh (or Reload) to run the script again</p>


</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.