[Javascript] Passing a variable to a Function

David Lovering dlovering at gazos.com
Thu Nov 20 13:26:13 CST 2003


Hmmm... maybe you need to use an 'eval' call:

<a href="javascript:myFunction(eval(myVariable))">myVariable</a>

I haven't tested this particular syntax recently, but some of my older code
runs OK with this in place.
All those who have more time than I do (or more recent experience), please
feel free to jump in with
the necessary corrections.

-- Dave Lovering

----- Original Message ----- 
From: <Kevin.Gutch at mapinfo.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Thursday, November 20, 2003 10:52 AM
Subject: [Javascript] Passing a variable to a Function


>
> I would like to pass a value to a function like this:
>
> <a href="javascript:myFunction('myData');">myData</a>
>
> however,
>
> I really want to pass a dynamic value/variable to the function. How would
I
> go about doing this in the function call? When I try it just gets passed
as
> a String.
>
> <a href="javascript:myFunction(myVariable);">myVariable</a>
>
> Am I making myself clear?
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list