473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I Need Help in Javascript Problem

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
Feb 28 '07 #1
4 2080
acoder
16,027 Expert Mod 8TB
Welcome to The Scripts.

Sorry, but I can't help but think that this must be homework, especially with the formatting of the question. How far have you managed to get with this problem?
Feb 28 '07 #2
Welcome to The Scripts.

Sorry, but I can't help but think that this must be homework, especially with the formatting of the question. How far have you managed to get with this problem?
reads the same backward and forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554 and 11611. Write 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”.



here is



<?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>Lab Exercise #5</title>

Javascript code removed - moderator

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

again</p>
</body>
</html>
Feb 28 '07 #3
acoder
16,027 Expert Mod 8TB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.

Then when you are ready post a new question in this thread.

MODERATOR
Feb 28 '07 #4
I am trying to divide the code to four function
Second. The Smallest does not work
Third when any of 10 Grade is not between 0 and 100 the alert box say that Grade (Number of Grade) is not a number between 0 and 100 Please correct!
for example Grade 5 is not a number between 0 and 100 Please correct !
Here is the code...........

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Array Processing</title>

<script>

function doProcess() {
var fields=document.forms[0].getElementsByTagName('INPUT');
var val=0;
var min=0;
var max=0;
var total=0;
for (var i=0;i<fields.length;i++) {

if ((fields[i].type=='text')&&(fields[i].name.indexOf('number')==0)) {
val=parseInt(fields[i].value);
if ((val<0)||(val>100)) {
alert('only numbers between 0 and 100!');

return false;
}

if (isNaN(val)) {
alert('All fields have to contain numbers');
return false;
}
total+=val*1;
if (val>max) max=val;
if (val<min) min=val;
}

}
document.forms[0].sum.value = total;
document.forms[0].average.value = total / 10;
document.forms[0].smallest.value = min;
document.forms[0].largest.value = max;
}

</script>
</head>
<body>
<h1>Array Processing</h1>

<form method = "post" action = "/cgi-bin/formmail" >


<input name = "number0" type = "text" size = "4"
maxlength = "5" />


<input name = "number1" type = "text" size = "4"
maxlength = "5" />


<input name = "number2" type = "text" size = "4"
maxlength = "5" />


<input name = "number3" type = "text" size = "4"
maxlength = "5" />


<input name = "number4" type = "text" size = "4"
maxlength = "5" />


<input name = "number5" type = "text" size = "4"
maxlength = "5" />


<input name = "number6" type = "text" size = "4"
maxlength = "5" />


<input name = "number7" type = "text" size = "4"
maxlength = "5" />


<input name = "number8" type = "text" size = "4"
maxlength = "5" />


<input name = "number9" type = "text" size = "4"
maxlength = "5" />

<br><br>

<input type="button" name="click1" value="Process" onClick="doProcess()">


<p>
<label>Sum:
<input name = "sum" type = "text" size = "4"
maxlength = "10" />


<label>Average:
<input name = "average" type = "text" size = "4"
maxlength = "10" />

<label>Smallest:
<input name = "smallest" type = "text" size = "4"
maxlength = "10" />

<label>Largest:
<input name = "largest" type = "text" size = "4"
maxlength = "10" />
</form>

</body>
</html>
Apr 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Derek | last post by:
Hi, I've built a rather large CGI that dumps a lot of data and a fairly complex javascript app out to the client's browser. Granted this may be poor style according to someone web design...
8
by: George Hester | last post by:
In a page I have when the user left-clicks the page a Input box for a form gets the focus. But if the user right-clicks the page the Input box is not getting the focus. I'd like the Input box to...
4
by: usl2222 | last post by:
Hi folks, I appreciate any assistance in the following problem: I have a form with a bunch of dynamic controls on it. All the controls are dynamically generated on a server, including all...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
3
by: RC | last post by:
Dear Dudes, I post this in multiple groups for opening brain storm. Sometime I need to query the data from database server then display them into user's browser in HTML <table>. But if the...
7
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair....
8
by: | last post by:
The problem lies here eval("document.TeeForm.amt.value(S+M)"); S and M suppose to add up and the total suppose to appear on the AMT field but it didn't. Any help? ...
9
by: whitgurley | last post by:
I've searched the web as well as I can for a solution to this problem but have found nothing and just don't know enough about JavaScript to figure out what's going. What I'm trying to do is convert...
25
by: Oltmans | last post by:
Hi guys, I'm learning JavaScript and I need some puzzles that can make me a better JavaScript programmer. I mean I'm looking out for programming puzzles (e.g. Project Euler or TopCoder) but I'm...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.