https://files.cnblogs.com/files/php-qiuwei/sweetalert.min.js
https://files.cnblogs.com/files/php-qiuwei/sweetalert.css
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="utf-8"> 5 </head> 6 <link rel="stylesheet" type="text/css" href="js/sweetalert.css" /> 7 <!-- <script type="text/javascript" src="js/jquery.min.js"></script> --> 8 <script type="text/javascript" src="js/sweetalert.min.js"></script> 9 <body> 10 <form action="" method="post" > 11 <input type="text" name="abc" id="abc" /> 12 <button><a href="javascript:void (0)" onclick="register()">注 册</a></button> 13 </form> 14 <script type ="text/javascript" > 15 function register(){ 16 var ab = document.getElementById( ' abc ' ).value; 17 // var ab = $('#abc').val(); 18 if ( ab == '' ){ 19 swal( " failure " , " please fill in the account " , " error " ); 20 swal( " failure " , " please fill in the account " ,"success"); 21 return; 22 } 23 $("#regForm").submit(); 24 } 25 </script> 26 </body> 27 </html>
Annotation: http://www.cnblogs.com/php-qiuwei/p/9003256.html