help :(

    Date: 10/26/05 (Javascript Community)    Keywords: browser, html, java

    Hello, I'm new to Javascript and I have an assignment for class in which I'm having trouble checking to see if textboxes are blank and to alert to user with window.alert to tell them to enter information, check to see if certain text boxes are numeric from a certain number range, and to validate the correct format.



    1. Create 2 standard HTML files called assignment5.htm and process.htm. The files should do the following:
    a. assignment5.htm
    i. Should be a form that’s action is set to “process.htm”, method is set to “GET”, with the following named textboxes formatted using a table:
    1. FIRST_NAME
    2. LAST_NAME
    3. AGE
    4. PHONE
    ii. The ONSUBMIT event handler for the form should call a function named ValidateForm(). ValidateForm() should do the following:
    1. Check to ensure FIRST_NAME, LAST_NAME, AGE, and PHONE are not blank.
    2. If any of these textboxes are left blank, display an error message using the alert() function with the name of the item left blank and set focus to that text box using the focus() method of the text box left blank.
    3. Ensure that the AGE text box contains a number between 1 and 150. If the age is not this value, display a message box with describing that an invalid number was entered for age and set focus to this text box.
    4. Use the following regular expression to validate the PHONE text box. If it returns false, display a message box detailing that the phone number is invalid and must be in the format (xxx) xxx-xxxx.

    /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/

    5. If all these conditions pass, return true and allow the form to go to process.htm.
    b. process.htm
    i. This page receives the information from the first page via the Querystring (URL). You will pull the information out of the document.location.search property and write the following to the browser:

    Hello . You are years old. Your telephone number is .

    Note: Everything in <> is from the assignment5.htm page.


    c. HINT
    i. Use the split(“&”) method off of the document.location.search string in order to break the search string into an array that has each of the name/value pairs in it.
    ii. You can then use the split(“=”) method on each of the elements returned from above to get at the name/value (element 0 = name, element 1 = value).







      Assignment 5








      
        
          
        

        
          
          
        

        
          
          
        

        
          
          
        

        
          
          
        
        
          
      
    Contact Information
    First Name:
    Last Name:
    Age:
    Phone:













      Process





    document.write("Hello 'FIRST_NAME' + 'LAST_NAME'. You are 'AGE' years old. Your telephone number is 'PHONE'. ")
      












    Thanks if anyone can help me.

    Source: http://www.livejournal.com/community/javascript/80676.html

« Quit question... || Generic Form Replace »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home