if(window.confirm('执行?')) fun();

解决方案 »

  1.   

    在脚本中用confirm()函数。
    if(confirm("")){
    ...
    }else{
    ...
    }
      

  2.   

    强烈推荐:
    using System.Window.Forms;
    ...................
    private void Button1_Click(object sender, System.EventArgs e)
    {

    DialogResult result;
    if(TextBox1.Text=="")
    {
    result=MessageBox.Show("You must enter a name.", "Name Entry Error",MessageBoxButtons.YesNo,
    MessageBoxIcon.Information,MessageBoxDefaultButton.Button1,MessageBoxOptions.ServiceNotification);
    if(result == DialogResult.Yes)
      {
      Label1.Text="文本框为空值!";
      }   
    }

    }