•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,006 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,395 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1030 | Replies: 2
![]() |
•
•
Join Date: Mar 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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
> 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
•
•
Join Date: Mar 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<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>
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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<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>
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- JavaScript problem in FF (JavaScript / DHTML / AJAX)
- Javascript Problem.... (JavaScript / DHTML / AJAX)
- Javascript problem in FIREFOX (JavaScript / DHTML / AJAX)
- Javascript Problem with Firefox (JavaScript / DHTML / AJAX)
- Page Cannot Be Displayed & javascript:doNetDetect() Errors (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: random background generation: javascript
- Next Thread: JavaScript & CSS challage



Linear Mode