SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript function question. help asap

    Hi

    Im just going over a tutorial. I have a test tomorro and this particular part is giving me problems.

    Im not sure how to do a function with 2 arguments.

    Heres the question.

    • Write a function with two arguments, low and high, say, that checks that they are both between 0 and 50, and that low is less than high. A value true is returned if these conditions are satisfied, otherwise a value false is returned. The main script code should prompt for two numbers, use the function to see if they satisfy the conditions and write the two values and the result of the function. Use an HTML page that has the title “Check Low and High”, has a suitable heading including your name, and then has the script.

    Could someone quickly make this up so i can learn from the code.

  2. #2
    SitePoint Member mattvg's Avatar
    Join Date
    Nov 2003
    Location
    Goleta, CA
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From "Core JavaScript Reference 1.5" Chapter 3 (http://devedge.netscape.com/library/...t.html#1004825):

    Syntax
    Code:
    function name([param] [, param] [..., param]) {
       statements
    }
    Thus a function with two arguments would be written like the following:
    Code:
    function name(arg1, arg2) {
      statements
    }
    Good luck!

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    USA
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look at the examples on this page:
    http://www.creighton.edu/~davereed/c...libraries.html
    Scroll down a little ways
    .
    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9


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
  •