I have a function that shows and hides a table when a element is clicked. But when the table content of the table is shown, the page goes up, so I would like to have an anchor to the element of the table. How can I do it?
function hideShowTable(id, fila){
    var mostrado=0;
    var primerBlock=0;
    var elem2 = 0;
    var elem = document.getElementById(id);
    if(elem.style.display=='block'){
        mostrado=1;
        elem.style.display='none';
    }   
    if(mostrado!=1) {
        loadDetails();
        elem.style.display='block';
        primerBlock = 1;
    }
}
function loadDetails() {
    var div2 = "#tablaOculta_"+idAjuste+fila;
        $.ajax({
            url: 'listadoAjustes.do',
            type: 'POST',
                data: {         
                    accion: "loadDetails"
                },
                success: function(data){
                    $(div2+" *").remove();
                    $(div2).append(data);
                    $(div2).focus();
            },              
            error: function(){
            }
    });
}
