Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/05/2009, 14:28
Avatar de rudy69
rudy69
 
Fecha de Ingreso: octubre-2008
Ubicación: espndeportes.com
Mensajes: 195
Antigüedad: 15 años, 6 meses
Puntos: 7
Respuesta: Varios select en mi pagina, evitar carga

Pues ya me hice algo, no estaba tan dificil ,

Código HTML:
<!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" />
<link rel="StyleSheet" href="/CSS/Tabla.css" type="text/css">
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">

function option(value) {
	var opt0 = new Option("hola1", "Como Estas1");
	var opt1 = new Option("hola2", "Como Estas2");
	var opt2 = new Option("hola3", "Como Estas3");
	var opt3 = new Option("hola4", "Como Estas4");
	var opt4 = new Option("hola5", "Como Estas5");
	var opt5 = new Option("hola6", "Como Estas6");
	var opt6 = new Option("hola7", "Como Estas7");
	var opt7 = new Option("hola8", "Como Estas8");
	var opt8 = new Option("hola9", "Como Estas9");
	var opt9 = new Option("hola10", "Como Estas10");
	
	
	document.x.e.options[0] = opt0;
	document.x.e.options[1] = opt1;
	document.x.e.options[2] = opt2;
	document.x.e.options[3] = opt3;
	document.x.e.options[4] = opt4;
	document.x.e.options[5] = opt5;
	document.x.e.options[6] = opt6;
	document.x.e.options[7] = opt7;
	document.x.e.options[8] = opt8;
	document.x.e.options[9] = opt9;
	document.x.e.value = value;
}
</script>
</head>

<body>
<form name="x">
<select name="e" onfocus="option(this.value)"><option value="Como Estas7">hola7</option></select>
<input type="submit" value="Calcular" />
</form>
<?php echo $_REQUEST['e']; ?>
</body>
</html> 
Le agrege un pequenyo efecto que lo hacia algo feito, si tiene un valor seleccionado desde un principio, te aparecera seleccionado cuando se creen los options despues, esta guapo, solo que no me gusta hacer dos veces esto:

var opt0 = new Option("hola0", "Como Estas0");


document.x.e.options[0] = opt0;

A ver si me ayudan a quitarlo si es posible

Última edición por rudy69; 20/05/2009 a las 14:45