Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Problem in Passing parameters


Message #1 by "arun" <arun@l...> on Mon, 22 Apr 2002 16:55:39 -0700
choise = "choise"+i;
remove the double quotes like
choise = choise+i;


----- Original Message -----
From: "arun" <arun@l...>
To: "javascript" <javascript@p...>
Sent: Tuesday, April 23, 2002 7:39 AM
Subject: [javascript] Re: Problem in Passing parameters


> Thanks Chris it works!!!!!!!!!!!
>
> Please forgive me. I have another problem. When i want to get the values
of
> choise1-5(the input parameters) to be displayed while printing the
variable
> "choise" it takes choise1-5 as a string. It prints:
>
> choise1
> choise2
> choise3
> choise4....
>
> But i want o/p like
>
> 8160 Hz
> 850 m ...
>
> function display (choise1, choise2, choise3, choise4, choise5, answer)
> {
> for (i=1; i<=5 ; i++)
> {
> choise = "choise"+i;
> alert(choise);
> if (choise != "")
> {
> document.write ('<input type=radio name="rbtn" value="ch1" onClick="return
> check(\'' + choise + '\',\'' + answer + '\')">');
> document.write (choise);
> document.write ("<BR>");
> }
> }
> }
>
> display("8160 Hz", "850 m", "136 Hz" ,"34 Hz", "","136 Hz");
> regards
>
> arun
>
> -----Original Message-----
> From: Chris Scott [mailto:chris@e...]
> Sent: Monday, April 22, 2002 5:30 AM
> To: javascript
> Subject: [javascript] Re: Problem in Passing parameters
>
>
> You also need to enclose your values in quotes (because they are strings),
> try...
>
> document.write ('<input type=radio name="rbtn" value="ch1" onClick="return
> check(\'' + choise1 + '\',\'' + answer + '\')">');
>
> (using \' to insert a single quote into the output)
>
>
>
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
>
>
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20


  Return to Index