SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    new york
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Guidance on Javascript!

    Hello,

    I have a couple of task that I like to work on but I need the push to lead me to the specific way of doing them.

    1) Write a form that takes a user's birthday. TIf the difference between the current year and the users birth year is less than 18, I want it to tell them to leave . . . otherwise show them the content.

    2) Wirte a form that asks the user to input his/her email. Write the javaScript code that would print out to the screen "User's town is a great town!" with an email link to the users email.

    3) Add form validation to insure the user has entered something in the city field and that the email has @ in the email field.


    Any guidance on these three things would be appreciated.

    Thanks,

    Homeboy

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Go to developer.mozilla.org and look up the following things:
    1. The Date object and its methods, specifically getFullYear will be helpful, and parse too, to parse the date entered by the user.
    2. I don't understand this too well. How does the system know what the town is just from the email entered? Anyway, to create the link, look up the DOM function "createElement".
    3. Search on google for a regular expression for emails, there are millions out there. Maybe add the word "javascript" to find a ready-made one. For form validation you need to decide if you want to validate as the user is typing or once the user presses a button. In any case you will need to add an event listener either to the field where the user types the information or to the button. The event will call your "validate" function.

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    new york
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Raffles,

    I want to thank you for the help that you have given me.

    Just one more favor to ask. I finished the form and the validations. Just want to see if you can take a look at it and also how can I send the form data to my email?

    http://kevinkashou.com/form/kkashou_q4.html I can't copy the code on the forums for some reason. But here is the form page that i use to create the stuff needed.

    Thanks once again.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •