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>
     


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

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

  • 相关阅读:
    为Internal页面添加一个Unit Test的运行入口
    使用 AWSTATS 来查看IIS/iisnode 日志
    用issnode+IIS来托管NodeJs Server之四:支持Debug
    Restify实践
    Mocha实践
    Graphite实战
    StatsD与Graphite联合作战
    单元测试
    NHibernate配置
    NHibernate概念
  • 原文地址:https://www.cnblogs.com/czk1634798848/p/11282907.html
Copyright © 2011-2022 走看看