...to pass the string in the parameters of the function... unfortunately just dont get it ...
If you look there is only one function declaration, but there are three calls to the same function passing a string value (string1, string2, string3).
<input type="button" onclick="myfunction('string1')" value="a)">
<input type="button" onclick="myfunction('string2')" value="b)">
<form><input type="button" onclick="myfunction('string3')" value="c)">
Skywalker's solution will work very well for you. However, as I noted in my original suggestion, your problem lies in the fact that the way you set it up, you keep declaring your function as "myfunction" each time, yet you are trying to get it to return 3 different things - the function needs to be called something different if you use it multiple times. - note the red numbers in the amended code below
Originally Posted by marija
You don't HAVE to call them myfunction1 and myfunction2, I simply named them as an example. They could just as easily be myfunctioncat, myfunctionmouse, myfunctiondog or myfunctionhugo, myfunctiongeorge, myfunction382, or whatever.
So, you can change your code as suggested by Skywalker, or if you leave your code as typed, just make sure each function is named differently.
Last edited by Mayday; 01-28-2009 at 01:20 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)