![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
21/06/2006, 17:25
|
![Avatar de SiR.CARAJ0DIDA](http://static.forosdelweb.com/customavatars/avatar68448_2.gif) | | | Fecha de Ingreso: junio-2004 Ubicación: Acá
Mensajes: 1.166
Antigüedad: 20 años, 7 meses Puntos: 4 | |
esto no esta mejor?
Código:
<html>
<head>
<script type="text/javascript">
function verify(s1) {
var s2;
for (var i=1;i<=3;i++) {
s2 = document.getElementById('color' + i);
if (s1.value == s2.value && s1 != s2) {
alert('Valor repetido');
s1.options[0].selected = true;
return;
}
}
}
</script>
</head>
<body>
<form name="colores" action="colores.php" method="POST">
Color 1:
<select name="color1" id="color1" onchange="verify(this)">
<option selected>Elige color</option>
<option value="Rojo">Rojo</option>
<option value="Verde">Verde</option>
<option value="Azul">Azul</option>
</select>
Color 2:
<select name="color2" id="color2" onchange="verify(this)">
<option selected>Elige color</option>
<option value="Rojo">Rojo</option>
<option value="Verde">Verde</option>
<option value="Azul">Azul</option>
</select>
Color 3:
<select name="color3" id="color3" onchange="verify(this)">
<option selected>Elige color</option>
<option value="Rojo">Rojo</option>
<option value="Verde">Verde</option>
<option value="Azul">Azul</option>
</select>
</form>
</body>
</html>
|