Gracias MKO y gebremswar por la ayuda, al final pude lograrlo simplemente agregandole
Código HTML:
$.getScript('habilitar.js');
despues de llamar la pagina en la funcion ajax. Pego el codigo por si ayuda a alguien
Pagina "1" donde se cargara la pagina "2"
Código HTML:
<script type="text/javascript" src="habilitar.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script lang="javascript">
function objetoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
//_________________________________________________________________________
function buscar(){ //esta es la funcion que envia los datos de manea asincrona
//div donde mostrararemos los datos de la consulta
divResultado = document.getElementById('resultado');
//tomamos el valor enviado del formulario de envio
clave=document.formulario.clave.value;
//instanciamos el objetoAjax
ajax=objetoAjax();
//usamos el medoto POST
//archivo que realizará la operacion
ajax.open("POST", "buscar_cod_vender.php",true);
$.getScript('habilitar.js');
//mostramos una imagen mientras cargamos el resultado de la consulta
//divResultado.innerHTML= '<img src="images/ajax.gif">';
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
//visualizamos el resultado correscpondiente
divResultado.innerHTML = ajax.responseText
}
}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
//enviando los valoress
ajax.send("clave="+clave)
}
</script>
<html>
<form action="" name="formulario" >
<input type="text" id="clave" > <button type="button" onClick="buscar()">buscar</button>
</form>
<div id="resultado">
</div>
</html>
Pagina "2"
Código HTML:
<?php
include_once 'lib.php';
$cod =$_POST['clave'];
$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'and codigo = $cod", $conexion);
?>
<form name="vender" method="post" action="vender_prod.php">
<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>
<?php
$i = 0;
while ($row = mysql_fetch_array($result)) {
?>
<tr>
<td><?php echo $row['id_stock'] ?></td>
<td><?php echo $row['codigo'] ?></td>
<td style="width: 500px"><?php echo $row['descrip'] ?></td>
<td align="right"><?php echo "$"; echo $row['pre_min'] ?></td>
<td align="right"><?php echo "$"; echo $row['pre_may'] ?></td>
<td align="center"><?php echo $row['disponibles'] ?></td>
<td><input id="chk_<?php echo $i ?>" name="seleccion[]" type="checkbox" value="<?php echo$row['id_stock'] ?>" class="chk"/></td>
<!-- <td style="border: none"></td>-->
<td><input id=txt_<?php echo $i ?>" name="cantidad[]" disabled="disabled" type="text" style="width: 60" class="txt"/></td>
</tr>
<?php
$i++;
}
?>
</table>
<br />
<input type="submit" name="submit" value="Enviar">
</form>
Pagina JS
Código HTML:
$(document).ready(function(){
$(".chk").change(function(){
var comentario = $( '.txt', $( this ).parents ( 'tr' ) );
if( $(this).is(':checked')){
comentario.removeAttr('disabled');
} else {
comentario.attr('disabled', true);
}
});
});
Gracias a todos