Javascript 执行js前弹出窗口
我有下面的代码Javascript 执行js前弹出窗口,javascript,Javascript,我有下面的代码 onclick='deleteTable("mytablename")' 在执行脚本之前,是否有任何方法可以弹出警告(您正在删除“mytablename”) 感谢使用确认询问用户是否确定删除: $result = confirm('are you sure of deleting a table?'); if($result){ //execute the js code because the user selected yes }else{ return; //exit
onclick='deleteTable("mytablename")'
在执行脚本之前,是否有任何方法可以弹出警告(您正在删除“mytablename”)
感谢使用确认询问用户是否确定删除:
$result = confirm('are you sure of deleting a table?');
if($result){
//execute the js code because the user selected yes
}else{
return; //exit
}
现场演示:将所有内容放入js函数中,函数首先检查警告,然后调用deletetable。。类似于if(confirm('you sure,you want to delete'){deleteTable(…)}