1.只有确定按钮
alert(“弹出弹框”);
2.确定和取消按钮
if(confirm(“是否确定删除?”)){
//发个ajax删除
}else{
return;
}
3.带文本框的弹出框
prompt的第一个参数为弹框的文本信息,第二个参数是文本框的默认输入信息(可以不填),点击取消返回null。 var name=prompt("请输入您的名字","Bill Gates")
if (name!=null && name!=""){ //判断是否为空
document.write("你好," + name + "!今天过得好吗?")
}
参考文章: http://www.cnblogs.com/xiaofengfeng/archive/2012/10/20/2732784.html