hola, alguien me ayuda para seleccionar el ultimo introducido en un select?, tengo este codigo
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function agrega(){
var opcion = document.createElement("option");
var contenido = document.createTextNode("dos");
opcion.appendChild(contenido);
document.form1.uno.appendChild(opcion);
}
</script>
</head>
<body>
<form name="form1">
<select name="uno">
<option value="1">uno</option>
<input type="button" value="agrega" onClick="agrega()" />
</form>
</select>
</body>
</html>
osea que despues de agregar el dos, este quede seleccionado en la lista
saludos