document.addEventListener('keydown', function(event) {
    // If the right arrow key is pressed
    if (event.keyCode === 39) {
        var nextLink = document.querySelector('.next-button').href;
        window.location.href = nextLink;
    }
    // If the left arrow key is pressed
    else if (event.keyCode === 37) {
        var prevLink = document.querySelector('.prev-button').href;
        window.location.href = prevLink;
    }
});