I really need some help, thanks. I need to create this function:
<input type="button" value="Refresh Page" onClick="history.go(0)">
But it must be created using the document.createElement () method and I'm not getting it, I've already tried it in several ways but I always end up with an empty input text box that does not work, and the button does not even appear.
If it is not possible to create this button, a writable AGAIN text for refresh also works. I tried to do this and the page is in eternal reload before being loaded. Taking advantage of the question, if I change the history.go(0)
to history.go(-1)
does it return to the previous page? Thank you in advance.
For link
var ae = document.createElement('a');
var eText = document.createTextNode("AGAIN");
ae.appendChild(eText);
ae.title = "AGAIN";
ae.href = window.location.reload();
document.body.appendChild(ae);
For Botao
var batsu = document.createElement("input");
batsu.setAttribute('type', 'button');
batsu.setAttribute('valeu', 'AGAIN');
batsu.setAttribute('onClick', 'history.go(0)');
document.body.appendChild(batsu);