0
When I press a button, is it possible to see a dialog box with the yes or no buttons? If I pressed yes, I’d go one way if I hit no, I wouldn’t be on the page. It is possible?
0
When I press a button, is it possible to see a dialog box with the yes or no buttons? If I pressed yes, I’d go one way if I hit no, I wouldn’t be on the page. It is possible?
0
It is possible yes, it can do this way:
if (confirm('Deseja mudar de pagina?')) {
window.location.href='http://google.com';
} else {
// fica na pagina
}
You can use javascript, you can look at this link, and in that here is an example
It is possible to click on ok and go to a page?
Rafael does not give answers only with links pf. Gives examples and explains how to do what the AP needs.
it is possible yes... you can do it this way if (confirm('Deseja mudar de pagina?')) {
 window.location.href='http://google.com';
 } else {
 // fica na pagina
 }
0
You can do it the traditional way via javascript. However the options are fixed to ok or cancel, since the confirm
is implemented internally in each browser.
<script>
confirma() {
if (confirm('Deseja realmente fazer determinada ação?')) {
// código caso tenha confirmado
} else {
// código caso tenha cancelado
}
}
</script>
<button onClick="cofirma();"> Botão de confirmação <button>
If it doesn’t suit what you want, since it is something much more specific, I recommend looking for a solution via a plugin, as in the case of the Bootstrap modals.
When pressing butao it is supposed to do something?
I think clicking the button will trigger the javascript function. O if nothing else that interprets the yes or no. That’s what I wanted to know?
Yes it was. But how do I get a box to say"yes or no"?
By default, the confirm
give only the ok or cancel option, not giving the option to modify the names by being encoded already in the browser.
@Brunogonçalves this answer may be useful.
But by clicking on ok, it can go to a link, page?
Yes, just implement within the if
window.location = 'urlDesejada'
0
You can use the function confirm
which is native to browsers. It returns true
or false
according to the user’s response.
if (confirm('Deseja ir para a página de configurações?')) {
window.location.href = 'config.php';
}
Browser other questions tagged php javascript html
You are not signed in. Login or sign up in order to post.
You could post what you’ve tried?
– Marconi
You use bootstrap or some form creation framework?
– Thiago Dorneles
The default on browsers is
var resposta = confirm("Confirma a operação?")
, with OK and Cancel buttons. Other than that, it’s on the same nail or with some framework.– bfavaretto
I don’t use any bootstrap or framework
– Bruno Gonçalves
I didn’t do anything because I don’t know where to start
– Bruno Gonçalves
to my understanding that a confirm. If you click yes redirects to a page if it is not in the current.
– Marconi
Yes I want that, you can help me?
– Bruno Gonçalves