I have javascript that handling key press enter trigger specific button event:
if (window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
if (key == 13) {
//Get the button the user wants to have clicked
var btn = document.getElementById(buttonName);
if (btn != null) { //If we find the button click it
btn.click();
event.keyCode = 0
}
It's works on IE and Firefox, but not on Chrome. Any solutions?
答案 0 :(得分:0)
将@Override
public List<Localidades> verLocalidades() {
List<Localidades> listaLocalidades = null;
Session sesion = HibernateUtil.getSessionFactory().openSession();
Transaction transaccion = sesion.beginTransaction();
String hql = "FROM Localidades";
//String hql = "SELECT l.idlocalidad, l.descripcion, l.esrural, l.iddistrito, l1.Descripcion FROM localidades l LEFT OUTER JOIN localidades l1 ON l.`idlocalidadpadre` = l1.`idlocalidad`";
try {
listaLocalidades = sesion.createQuery(hql).list();
transaccion.commit();
//sesion.close();
} catch (Exception e) {
transaccion.rollback();
}finally{
if(sesion != null){
//sesion.close();
}
}
return listaLocalidades;
}
用于Chrome。据我所知,它也适用于IE和Firefox