zoukankan      html  css  js  c++  java
  • html表单填写时条件弹框

    方法一:

    jsp中:


    <c:if test="${param.message=='1'}">
      <script>
        alert('捐款成功,谢谢您的支持,祝您安康幸福!');
      </script>
    </c:if>


    <c:if test="${param.message=='0'}">
      <script>
        alert('系统故障,操作失败,请重新添加!');
        window.location = 'addView.jsp';
      </script>
    </c:if>

    action中:

         if (ok) {
    response.sendRedirect("showLoveInHeartWeb?message=1");//1代表成功
    }else{
    response.sendRedirect("showLoveInHeartWeb?message=0");//0代表失败
    }

    方法二:

    jsp中:
    <script>
    function check() {
    var formname = document.form1;
    if (formname.lname.value != "") {
    alert("添加成功");
    return true;
    }
    if (formname.lname.value == "") {
    alert("姓名不能为空!");
    formname.lname.focus();
    return false;
    }
    }
    </script>
    <form action="addLoveInHeartWeb" method="post" onSubmit="return check(this)" name="form1">

    <table border="1">
    <tr><td><input type="text" name="lname"></td></tr>
           <tr><td><input type="submit" value="提交"></td></tr>
    </table>
    </form>
     


    ---恢复内容结束---

    ---恢复内容结束---

  • 相关阅读:
    leetcode刷题总结401-450
    leetcode刷题总结351-400
    马哥博客作业第六周
    马哥教育第一阶段考试
    马哥博客作业第四周
    马哥博客作业第三周
    马哥博客作业第二周
    马哥博客作业第一周
    马哥博客预习作业第三周
    马哥博客预习作业第二周
  • 原文地址:https://www.cnblogs.com/czk1634798848/p/11282907.html
Copyright © 2011-2022 走看看