I am using confirm(Are you sure you wnat to do it?) in javascript. The dialog box in confirm shows two buttons - Ok and cancel. By default, the focus is on Ok. I want to change the default focus to Cancel. How can I do it?
One reason that springs instantly to mind: Many of us use the keyboard to shortcut moving the mouse... If we knew that a specific button had focus, we could press Enter or Space as soon as the dialog appeared to action a specific point, without having to check which option was focussed.
I meant something as simplistic as this.
[tt]
sprompt="Our policy discourages you to submit this without thinking it all over again.\n"+
"Your action will be blocked by default.\n"+
"If you insist in submitting it, Please cancel this prompt.\n"+
"Else, please confirm you want to have a second though before submitting."
if (confirm(sprompt)) {
formname.submit();
}
[/tt]
- tsuji
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.