Tengo 3 radio buttons, que se llaman "opcion" y cada uno tiene un valor diferente: zona, precio, todos.
Cuando pulso un botón de tipo "button" quiero que se ejecute una pequeña función javascript que me abra otra pequeña ventana y se muestre el valor del radiobutton seleccionado.
Pues me da un error en la página y ni siquiera abre la ventana. Os pongo el código haber si alguien me puede ayudar. Gracias!!
Código PHP:
<!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" />
<title>Documento sin título</title>
<style type="text/css">
<!--
.Estilo1 {font-family: Tahoma}
body {
background-color: #FFFF99;
}
.Estilo2 {font-family: Tahoma; font-weight: bold; }
-->
</style>
</head>
<script>
function buscar(){
var i
for (i=0;i<document.form2.opcion.length;i++){
if (document.form2.opcion[i].checked)
break;
}
window.open('criteriobusqueda.php?opcion='+opcion[i].value,'vent','resizable=yes,width=600,height=255');
}
</script>
<body>
<form action="" method="post" name="form2">
<div id="Layer1" style="position:absolute; left:103px; top:51px; width:835px; height:293px; z-index:1; background-color: #FFCC00; layer-background-color: #FFCC00; border: 1px none #000000;">
<p class="Estilo1">Seleccione el criterio de búsqueda para buscar ofertas :</p>
<table width="320" border="1">
<tr>
<td width="59" class="Estilo1"><label>
<input name="opcion" type="radio" value="zona" />
</label></td>
<td width="245" class="Estilo1"><strong>
<label>ZONA:</label>
</strong></td>
</tr>
<tr>
<td class="Estilo1"><label>
<input name="opcion" type="radio" value="precio" />
</label></td>
<td class="Estilo1"><strong>
<label>PRECIO ENTRE: </label>
</strong></td>
</tr>
<tr>
<td class="Estilo1"><label>
<input name="opcion" type="radio" value="todos" />
</label></td>
<td class="Estilo2">TODOS LOS PISOS</td>
</tr>
</table>
<p class="Estilo1">
<label>
<input type="button" name="" value="ACEPTAR" onclick="buscar()"/>
</label>
</p>
</div>
</form>