Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Problem with javascript variable


Message #1 by "arun" <arun@l...> on Wed, 10 Apr 2002 19:02:37 -0700
It works john...Thanks for the help

-----Original Message-----
From: Boloian, John [mailto:jboloian@u...]
Sent: Tuesday, April 23, 2002 6:37 AM
To: javascript
Subject: [javascript] RE: Problem with javascript variable


Arun, a couple of things:

1) When making the function call, you need to replace the double=quotes
around the parameters with single-quotes.

2) Use the 'eval' statement in your function for selecting the choice+i.

Below is your code, slightly modified... Hope it helps!


<html>
<head>
	<title>Untitled</title>
<script language="javascript">
function display (choise1, choise2, choise3, choise4, choise5, answer) {

for (i=1; i<=5 ; i++) {

choise = eval("choise"+i); // also i tried 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>");
}
}
}


</script>

</head>

<body onLoad="javascript:display('8160 Hz', '850 m', '136 Hz' ,'34 Hz',
'','136 Hz');">

</body>
</html>

-----Original Message-----
From: arun [mailto:arun@l...]
Sent: Wednesday, April 10, 2002 10:03 PM
To: javascript
Subject: [javascript] Problem with javascript variable

...


---

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