Cita:
Iniciado por xxxivanxxx
PHP es el lenguaje de programacion, lo que muestra en tu pantalla (el resultado) es HTML, asi que puedes combinar tu codigo PHP y JS
asi:
Código Combine:
Ver original<?php
//codigophp
?>
codigo html;
<script>
//codigo js
</script>
-------------------------------------------------------------------------------------------------
creo que estas confundiendo, no es JAVA es JAVASCRIPT y perfectamente funciona :)
Hola xxxivanxxx, te comento que tenias razon, pude meter el codigo javascript sin problemas, el problema es que nose porque solo me funciona con el primer tilde y textbox. Las otras textbox siguen desabilitadas asi las tilde o no.
el codigo quedo asi
Código PHP:
<?php
include_once 'lib.php';
$conexion= mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($database, $conexion);
$result = mysql_query("SELECT id_stock, codigo, descrip, pre_min, pre_may, disponibles FROM stock where activo = '1'", $conexion);
echo"<form name='borrar' method='post' action='vender_prod.php'>";
echo"<table border='2'>
<tr>
<th>ID</th>
<th>Codigo</th>
<th>Descrip</th>
<th>Prec.Min</th>
<th>Prec.May</th>
<th>Disponibles</th>
<th></th>
<th style='border: none'></th>
<th>Cantidad</th>
</tr>";
$i=0;
while($row = mysql_fetch_array($result)){
echo "<tr>
<td>$row[id_stock]</td>
<td>$row[codigo]</td>
<td>$row[descrip]</td>
<td align=right>$$row[pre_min]</td>
<td align=right>$$row[pre_may]</td>
<td align=center>$row[disponibles]</td>
<td><input id='chk' name='seleccion[]' type='checkbox' value=$row[id_stock] onclick='validarchk();'></td>
<td style='border: none'></td>
<td><input id='txt' name='text[$row[id_stock]]' disabled='disabled' type='text' style='width: 60'></td>
</tr>";
$i++;
}
echo "</table>";
echo "<br>";
echo "<input type='submit' name='submit' value='enviar'>";
echo "</form>";
?>
<script>
function validarchk(){
var chk = document.getElementById('chk');
var txt = document.getElementById('txt');
if(chk.checked){
txt.disabled='';
}else{
txt.value='';
txt.disabled='disabled';
}
}
</script>
Que puede ser???