I Need Help in Javascript Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marylove2007
    New Member
    • Feb 2007
    • 3

    #1

    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*100 00)/10)
    > This is not a Homework at all.
    > plzz in Java script.
    > Helllllllllllll lllllllllllllll p
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #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?

    Comment

    • marylove2007
      New Member
      • Feb 2007
      • 3

      #3
      Originally posted by acoder
      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>
      Last edited by acoder; Feb 28 '07, 06:27 PM. Reason: Code removed

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        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

        Comment

        • marylove2007
          New Member
          • Feb 2007
          • 3

          #5
          I Need Help in Javascript Please

          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].getElementsByT agName('INPUT') ;
          var val=0;
          var min=0;
          var max=0;
          var total=0;
          for (var i=0;i<fields.le ngth;i++) {

          if ((fields[i].type=='text')& &(fields[i].name.indexOf(' number')==0)) {
          val=parseInt(fi elds[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="doProc ess()">


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


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

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

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

          </body>
          </html>

          Comment

          Working...