开发者

alert for confirm delete

Client Side Co开发者_高级运维nformation

var answer = confirm ("Are you sure you want to delete!");
if (answer)
 {
   alert ("Deleted.");  
 }    

Here I want when it ask for confirmation in place of OK and Cancel I need Yes and No. How I can provide this?


You can't.

Those buttons you see are standard ones provided by the browser.

You would have to use an alternative JavaScript-based library like jQuery UI dialog to do this.

However note that those libraries require you to change your program flow, because they work in a different way than confirm() (You can't have the dialog function return the answer. See the demo code on the jQuery UI site to see what I mean.)


You could do something similar to the below code to simulate a modal pop up.

JS:

window . open ('welcome.html', '', 'width=400,height=200');

Welcome.html:

<html>
 <head>
  <title>Welcome!</title>
 </head>
 <body>
  <form>
   Thanks for visiting our web site.
   <p>
   <input
    type=button
    value="OK"
    onClick="window . close ();">
  </form>
 </body>
</html>

Source: http://sharkysoft.com/tutorials/jsa/content/008.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜