I’ve figured out how to get contents into a textarea based on a radio button selection.
<script>
text = new Array()
text[0] = Array('Saab','Volvo','BMW');
text[1] = 'second list';
function populate(r,f){
t=-1;
for(var i=0;i<f.elements[r].length;i++){
if (f.elements[r][i].checked){
var t=i;
}
}
if(t>-1)
{f.txt.value=text[t]
}
}
</script>
</head>
<body>
<form>
<textarea name="txt" cols="20" rows="4"></textarea>
<br>
<br>
<input type="radio" name="radio" value="0" onClick="populate(this.name,this.form)">
Default List
<input type="radio" name="radio" value="1" onClick="populate(this.name,this.form)">
Another List
</form>
But what I can’t figure out is how to separate the lists line-by-line. For example: presenting the first selection above as
Saab
Volvo
BMW
as opposed to
Saab, Volvo, BMW
I assumed I would have to make an array within as array to accomplish this. Am I on the right track?