把代码放在Page_load中2.加个return "return window.confirm('are you sure?');"

解决方案 »

  1.   

    放在Page_load事件中
    delete.attribute.add("onclick","if(window.confirm(
       'Are you sure!'){return true;}else{return false;}") ;
      

  2.   

    正解:我一直在用的方法
    delete.attribute.add("onclick","return(confirm('Are you sure!'));") 
    首先要加RETURN,并且RETURN的值要用括号括起来
    第二,脚本中不要再用双引号了,用单引号吧
    第三,你漏写了一个双引号,编译是不会通过的