-2
I’m learning Java and I had a question, when I put:
<button onclick= "this. innerHTML = prompt('Qual o nome do botão?'); ">qual o nome do botão</button>
I can change the name of the button, so I wanted that when I put to the button call: Exit the page, that same button receive another function, which is to return the previous page. I wanted to know if there’s a way and if there is, how could I?
how about something like
onclick="if (function1()) function2();
? of course the first Function must return true/false– Ricardo Pontual
To perform a function after exiting the page, you can trigger the Unload event on this page:
window.addEventListener('unload', suaFuncaoDeRetorno)
. Within that function:suaFuncaoDeRetorno
can put typehistory.back(0);
or the address you were wanting to call, or even lock the exit...– Ivan Ferrer