Я видел, как делают переход, но не много не такой
let showContent = link => {
let [cont, http] = [document.getElementById('contentBody'), createRequestObject()];
if(http){
http.open('get', link);
http.onreadystatechange = () => {
http.readyState == 4 && (cont.innerHTML = http.responseText);
}
http.send(null);
}
else document.location = link;
}
// создание ajax объекта
const createRequestObject = () =>{
try { return new XMLHttpRequest() }
catch(e){
try { return new ActiveXObject('Msxml2.XMLHTTP') }
catch(e){
try { return new ActiveXObject('Microsoft.XMLHTTP') }
catch(e) { return null; }
}
}
}
<form>
<input onclick="showContent('page1.html')" type="button" value="Страница 1">
<input onclick="showContent('page2.html')" type="button" value="Страница 2">
</form>
Я разместил это на index.html, там же и отрисовываются страницы, не меняется location. Мне же нужно, чтобы location менялся на соответствующий (page1.html, например).