Gracias
Javier01 Probe tu código y funciona bien lo malo es que yo estoy manejando arrays
Código PHP:
<script>
function marcar(){
//El Try es para evitar caidas si el elemento no existe
try{
document.getElementById('check' + document.getElementById('ID').value).checked=true;
}catch(e){
}
}
$("input#ID").remove();
</script>
Código HTML:
<script>
function disable_enter(e){
var key;
if(window.event){
key = window.event.keyCode;
}
else{
key = e.which;
}
if(key == 13){
marcar();
document.getElementById('ID').value =''; //limpiar input
//document.getElementById('ID').select(); // Seleccionar texto
return false;
}
else{
return true;
}
}
</script>
Este es mi form
Código PHP:
<form id="form1" name="form1" method="POST" >
<label style="font-size:14px">ID:
<input type="text" name="ID" id="ID" onKeyPress="return disable_enter(event)">
</label>
<label>
<input type="button" name="buscar2" value="Buscar" onClick="marcar();" />
</label>
</form>
Y aqui mi check
<input name="aplica[]" value="<? echo $row['ID'];?>" type="checkbox" <?php if($row['ID'] == $_POST['ID']) echo "checked='checked' "; ?> id="check<? echo $rows ['ID'];?>" class="check" />
<input name="hora[]" type="text" value="" id="hora[]" />
La verdad no intento incomodar a nadie al preguntar, he leído ya sobre javascrip pero al trabajar con arrays me cuesta mucho...
Lo que hago es buscar un ID se quito la opción que al enter envie el form (segundo script)... ahora necesito q si encontro algun ID se marca (eso ya lo hace)
y que al marcalo se ponga la hora en el input hora...
desde ya muchas gracias