0

Hi, I'm looking for some help.

I need to add the letter "a" to the id of an option. The content is dynamic but you will get the idea from below.

Any help would really be great. Thanks

e.g.

<script type="text/javascript"> 
	function Toggle(id) { 
	document.getElementById("a18").style.display = "none"; 
	document.getElementById("a19").style.display = "none"; 
	document.getElementById("a20").style.display = "none";
	document.getElementById(id).style.display = "block"; } // need to add "a" to the id
	</script>  

<html>
<input type="radio" name="abc"  onClick="Toggle(a18);" value="a18"> //18 is the id from the database
<input type="radio" name="abc"  onClick="Toggle(a19);" value="a19">//19 is the id from the database
<input type="radio" name="abc"  onClick="Toggle(a20);" value="a20">//20 is the id from the database

<div id="a18" style="float:left; display: none; margin:9px 0px 0px 30px;">
<img src="images/a18.png"></div> 

<div id="a19" style="float:left; display: none; margin:9px 0px 0px 30px;">
<img src="images/a19.png"></div> 

<div id="a20" style="float:left; display: none; margin:9px 0px 0px 30px;">
<img src="images/a20.png"></div> 
</html>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by technopup
0

Looking at the code snippet posted by you, I dont think you need to append 'a' as you are already passing parameters like 'a19', 'a20'.....etc in the Toggle() function.
Only thing is that pass them as a string as shown in eg below

...
<input type="radio" name="abc"  onClick="Toggle('a18');" value="a18"> //18 is the id from the database
....

Hope this was helpful

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.