[thelist] javscript variables question - easy one

Matt Warden mwarden at gmail.com
Wed Feb 9 13:28:51 CST 2005


On Wed, 09 Feb 2005 12:50:26 -0500, Brian Delaney
<brian.delaney at mccmh.net> wrote:
> I have  function that checks for valid date input. function datecheck()
>  The function checks for the possibility that a user entered a start and
> end date.
> so I declared global variables: globalStart globalEnd
> I pass these to datecheck datecheck(globalStart, globalEnd) from the
> main function main()
> if both fields are not = NULL then I assign:
> globalStart = globaStart + form.txtStartdate.value
> globalEnd = globalEnd + form.txtEnddate.value
> If i use the alert() to display the value of  these in the datecheck()
> they are correct.
> If i use the alert() in the main() calling function they display NULL -
> blank values.
> How do I get the function to return or  modify 2 or more variables?

AFAIK, you cannot pass by reference like you are trying to do in
Javascript [1]. Try returning an array where startdate is index 0 and
enddate is index 1.

[1] http://www.webreference.com/js/tips/010210.html

Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list