如何在jquery中编写确认框代码?

时间:2011-07-04 04:25:57

标签: javascript jquery asp.net

如何在asp.net2.0中编写jquery,我点击按钮显示确认框根据要求

  • 确认框也会更改按钮(是,否)和图像(警告,信息等)和标题 请给我总代码,添加库以及如何在asp.net2.0中编写函数。
  • 警告框也会根据情况显示图像和标题。

    1. 添加了哪些库以及如何编写函数
    2. 功能:      $(“#confirm_button”)。click(function(){

      jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
                                      jAlert('Confirmed: ' + r, 'Confirmation Results');
                                  });
                              });
      

      我点击按钮代码,如

**

> <input id="confirm_button"
> type="button" value="Show Confirm" />

**

请帮助我

THNAK U. HEMANTH

2 个答案:

答案 0 :(得分:2)

$(document).ready(function()
{
    $("#iId").click(function () 
    {
        if (confirm('Your confirm text?')) 
    {
            //confirm='true', (means if you click on ok)
        // your code will go hire
        }
        else
    {
        //confirm='false', (means if you click on cancle)
            // your code will go hire
    }

    });
});

注意:您必须在代码中保留jquery-ui脚本文件

答案 1 :(得分:1)

您应该查看jquery UI对话框: http://jqueryui.com/demos/dialog/

希望这会有所帮助。干杯