Javascript - How many arguments are there for confirm?
How many arguments are there for confirm box?
What does var del=confirm("Are you sure?","Delete","开发者_开发百科");
mean?
It has a single argument which represents the text. In your example the last two arguments will be ignored. I suppose it is a failed attempt to personalize the buttons.
Only the first is meaningful. Any subsequent ones are ignored.
use this only ....
var del=confirm("Are you sure?");
else must be ignored.....this is the default feature in confirm box... that show "ok" and "cancel" by its own
and this will return true.
.if "ok" clicked.. and rteurn false
...if "cancel " clicked
confirm
accepts only one argument:
var ans=confirm('Your message');
It will display your message with OK and Cancel buttons.
精彩评论