SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Jan 30, 2008, 10:26 #1
- Join Date
- Nov 2005
- Posts
- 26
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is it possible to call a Js function with array parameter direct from HTML?
Hi,
Title should be partly self-explanatory.
I have a situation where I need to make a function call direction from HTML (i.e. using something like onClick="myFunction(myParam1, myParam2);") but the problem is that I'd like, ideally, to pass a javascript array as a parameter instead of values, for example:
HTML Code:<script> myArray[0] = myParam1; myArray[1] = myParam2; </script> onClick="myFunction(myArray);"
I can't see any straightforward way of doing this. Is there one?
Cheers,
Matt
-
Jan 30, 2008, 10:57 #2
- Join Date
- Nov 2005
- Posts
- 26
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Scratch this - I can do what I need by referencing function.arguments.
Cheers,
Matt
Bookmarks