Necesito que un textarea
me valla sumando los datos seleccionados en un select
. Hasta el momento me muestra el dato seleccionado en el textarea,
pero al seleccionar otra opción, no me mantiene el select
anterior en el textarea
. Aquí está el código:
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
function actualizar()
{
var miArray=new Array();
miArray[0]="Ampolleta70";
miArray[1]="Ampolleta120";
miArray[2]="Ampolleta1200";
var texto = document.getElementById('eltexto');
if(document.getElementById('opcion1').selected) texto.value = miArray[0];
if(document.getElementById('opcion2').selected) texto.value = miArray[1];
if(document.getElementById('opcion2').selected) texto.value = miArray[2];
}
</Script>
</head>
<body>
<form>
<select onChange="actualizar()">
<option id="opcion1">Ampolleta70</option>
<option id="opcion2">Ampolleta120</option>
<option id="opcion2">oAmpolleta 1200</option>
</select>
<br>
<textarea id="eltexto" rows="10" cols="40"></textarea>
</form>
</body>
</html>