SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Sep 2002
    Location
    Downunder
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Functions, can l do this

    <%= functionName(value1, value2) %>

    Trying to call a function which returns the modulo of two numbers, can l simply whack the function name in and the value will be returned ?

    Hope that makes sense.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <%= value1 Mod value2 %>

  3. #3
    SitePoint Evangelist
    Join Date
    Sep 2002
    Location
    Downunder
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the answer Jim, unfort the function does a few other things, so in essense l need to call it for other values, the function name is set with the modulo.

  4. #4
    Guru Bullschmidt's Avatar
    Join Date
    Apr 2002
    Location
    USA
    Posts
    524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Trying to call a function which returns the modulo of two numbers, can l simply whack the function name in and the value will be returned ?
    If the function is working correctly <%= functionName(value1, value2) %> should work just like <%= Date() %> shows the current date.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  5. #5
    SitePoint Evangelist
    Join Date
    Sep 2002
    Location
    Downunder
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Paul

  6. #6
    SitePoint Guru Wullie's Avatar
    Join Date
    Oct 2002
    Location
    Greenock, Scotland
    Posts
    701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As long as you return the value in the function your fine. However, if you want to display the result then you need to make sure you write the code to do it

    Response.write functionName(value1, value2)

    or as you have done above

    <%= functionName(value1, value2) %>

    If you know you are always goinf to write the result to screen you could use a subroutine and just response.write the answer withing the subroutine. But the function gives you more flexibility and allows you to work with the result.
    ASP.NET Freelance Web Developer
    Bored? Check out my photography folio at Flickr

  7. #7
    SitePoint Evangelist
    Join Date
    Sep 2002
    Location
    Downunder
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the answers. The function is now working as expected


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
  •