Skip to content

Instantly share code, notes, and snippets.

@ricardosiri68
Last active August 29, 2015 14:24
Show Gist options
  • Save ricardosiri68/794d7931dd10b650e190 to your computer and use it in GitHub Desktop.
Save ricardosiri68/794d7931dd10b650e190 to your computer and use it in GitHub Desktop.
function Combo(selector) {
var selectores = document.getElementsByClassName(selector.name);
for (var i = 0; i<selectores.length; i++) {
selectores[i].selectedIndex = selector.selectedIndex;
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>combos</title>
<script language="javascript" type="text/javascript" src="app.js"></script>
</head>
<body>
<form action="send.php">
<table border="1">
<tr>
<td>Tabla</td>
<td>A</td>
</tr>
<tr>
<td>1</td>
<td>
<select name="or" id="or" onchange="Combo(this)">
<option value="0"></option>
<option value="1">op1</option>
<option value="2">op2</option>
</select>
</td>
</tr>
<tr>
<td>1.1</td>
<td>
<select class="or" name="1_1" id="1_1">
<option value="0"></option>
<option value="1">op1</option>
<option value="2">op2</option>
</select>
</td>
</tr>
<tr>
<td>1.2</td>
<td>
<select class="or" name="1_2" id="1_2">
<option value="0"></option>
<option value="1">op1</option>
<option value="2">op2</option>
</select>
</td>
</tr>
</table>
<div>
<input type="submit" value="Guardar" />
</div>
</form>
</body>
</html>
<?php
var_export($_GET);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment