使用php和javascript显示警报框
发布时间:2020-12-13 16:51:28 所属栏目:PHP教程 来源:网络整理
导读:if (!(isset($_POST['fullname']) strlen($_POST['fullname']))) { echo "script type="text/javascript"". "window.alert('You must enter your full name.');". "/script"; exit; } 上面的代码在register.php文件中.我在index.html中有html表单.当我发布
if (!(isset($_POST['fullname']) && strlen($_POST['fullname']))) { echo "<script type="text/javascript">". "window.alert('You must enter your full name.');". "</script>"; exit; } 上面的代码在register.php文件中.我在index.html中有html表单.当我发布没有全名的表格.它显示警报但页面卡在register.php(空白页.) 解决方法
在脚本中尝试window.location.href =’/ index.html
if (! (isset($_POST['fullname']) && strlen($_POST['fullname']))) { echo "<script type="text/javascript">window.alert('You must enter your full name.');window.location.href = '/index.html';</script>"; exit; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |