![:-S](http://static.forosdelweb.com/fdwtheme/images/smilies/crap.png)
![:-S](http://static.forosdelweb.com/fdwtheme/images/smilies/crap.png)
Mi problema
![Confundido](http://static.forosdelweb.com/fdwtheme/images/smilies/confused.png)
![Confundido](http://static.forosdelweb.com/fdwtheme/images/smilies/confused.png)
Dejo el codigo de mi script para ver si me podeis ayudar, busco la compatibilidad con todos los navegadores por lo menos con los principales. (IE, moz, crome)
ARCHIVO productos.php
<body> ......
Código PHP:
Ver original
<?php ?>
Código HTML:
Ver original
Código PHP:
Ver original
<?php // codigo introducido en el tr que quiero que se seleccione y se coloree echo '<tr class="selected" onclick="check_selected(this)" id="tr_selected">'; echo '<td align="center"><input type="checkbox" name="check[]" id="check" value="'.$reg['idProducto'].'" /></td>'; echo '<td align="center">'; echo MostrarImagenProducto($reg['idProducto']).'</td>'; echo '<td align="center">'.$reg['idProducto'].'</td>'; echo '<td align="center">'.$reg['strReferenciaProducto'].'</td>'; echo '<td align="left">'.$reg['strNombreProducto'].'</td>'; echo '<td align="center">'.$reg['dblPrecioProducto'].' €</td>'; echo '<td align="center">'.TextoTipoIVA($reg['intTipoIVA']).'</td>'; echo '<td align="center">'.$reg['intStock'].'</td>'; echo '<td align="center">'.ObtenerImagenEstado($reg['intEstadoProducto']).'</td>'; echo '<td align="center"><a class="edit" href="productos_edit.php?product='.$reg['idProducto'].'"></a></td>'; echo '<td align="center">'; echo '<select OnChange="if(this.options[1].selected) { DuplicateElement('.$reg['idProducto'].'); } if(this.options[2].selected) { DeleteElement('.$reg['idProducto'].'); }" >'; echo '<option></option>'; echo '<option>Duplicar</option>'; echo '<option>Eliminar</option>'; echo '</select>'; echo '</td></tr>'; } ?>
Código HTML:
Ver original
</tbody> <tfoot> <tr> <th colspan="4" class="sel_check"> <select OnChange="if(this.options[1].selected) { SelectElements(); } if(this.options[2].selected) { DeselectElements(); } if(this.options[3].selected) { DeleteElementsSelected(); }" id="select_id"> </select> </th> </tr> </tfoot> </table> </form> </body> </html>
Y las funciones javascript son las siguientes:
Todas funcionan corectamente pero no consigo darle color al tr donde esta el checkbox seleccionado.
ARCHIVO global_functions.js
Código Javascript:
Ver original
function check_selected(i) { ch = i.getElementsByTagName("input")[0]; ch.checked =! ch.checked; if (ch.checked) { i.style.backgroundColor = "#ffc"; } else { i.style.backgroundColor = "#fff"; } } //------------------------------------------------------------------ //--------------------------------------------------- select options function SelectElements() { for (i = 0; i < document.select_form.elements.length; i++) if (document.select_form.elements[i].type == "checkbox") { document.select_form.elements[i].checked = true; document.select_form.select_id.value = 0; } } function DeselectElements() { for (i = 0; i < document.select_form.elements.length; i++) if (document.select_form.elements[i].type == "checkbox") document.select_form.elements[i].checked = false; document.select_form.select_id.value = 0; } function DeleteElementsSelected() { var option = document.getElementById("select_form").check; var cont = 0; for (var x = 0; x < option.length; x++) { if (option[x].checked) { cont = cont + 1; } } if (cont == 0) { alert("No ha seleccionado ningun elemento") location.reload(); } else { message = confirm("Seguro que desea eliminar los elementos seleccionados?") if (message != 0) { document.all["select_form"].submit(); } else { document.select_form.select_id.value = 0; return; } } } function DuplicateElement(i) { message = confirm("Se duplicara todo el contenido de esta seleccion") if (message != 0) { window.location = "../admin/productos_duplicate.php?producto="+i+""; } else { location.reload(); } } function DeleteElement(i) { message = confirm("Seguro que desea eliminar el elemento seleccionado?") if (message != 0) { window.location = "../admin/productos_delete.php?producto="+i+""; } else { location.reload(); } }
Seguro que es algo sencillisimo pero se me escapa.
Gracias
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)