zoukankan      html  css  js  c++  java
  • JSP-打印动态表格

    input.html

    <script language="javascript">
      function validate(f){
        if(!(/w+/.test(f.info.value))){//正则表达式
        alert("输入的内容不能为空!");
        f.info.focus();
        return false;
        }
        return true;
      }
    </script>
    
        This is my HTML page. <br>
        <FORM METHOD = "Post" action = "INPUT.jsp" onSubmit="return validate(this)">
          输入信息:<input type = "text" name = "info">
          <input type = "submit" value ="info">
          
        </FORM>
        
        <br>
        
        <script>
           function check(f){
            if(!(/^d+$/.test(f.rows.value))){
             alert("行数必须是数字");
             return false;
            }
            if(!(/d+/.test(f.cols.value))){
             alert("列数必须是数字");
             return false;
            }
            return true;
           }
        </script>
        <hr>
        <form action="printTable.jsp" method="post" onSubmit="return check(this)">
           <table border="0">
              <tr>
                 <td colspan="2">"打印表格"</td>
              </tr>
             <tr><td>输入打印表格的行数</td>
             <td><input type="Text" name="rows"></td>
             </tr>
              <tr><td>输入打印表格的列 数</td> 
             <td><input type="Text" name="cols"></td>
             </tr>
             <tr>
               <td colspan="2">
                 <input type ="submit" value="打印">
                 <input type="reset" value="重置">
               </td>
             </tr>
         
        
        </form>
    View Code

    printTable.jsp

    <script language="javascript">
      function validate(f){
        if(!(/w+/.test(f.info.value))){//正则表达式
        alert("输入的内容不能为空!");
        f.info.focus();
        return false;
        }
        return true;
      }
    </script>
    
        This is my HTML page. <br>
        <FORM METHOD = "Post" action = "INPUT.jsp" onSubmit="return validate(this)">
          输入信息:<input type = "text" name = "info">
          <input type = "submit" value ="info">
          
        </FORM>
        
        <br>
        
        <script>
           function check(f){
            if(!(/^d+$/.test(f.rows.value))){
             alert("行数必须是数字");
             return false;
            }
            if(!(/d+/.test(f.cols.value))){
             alert("列数必须是数字");
             return false;
            }
            return true;
           }
        </script>
        <hr>
        <form action="printTable.jsp" method="post" onSubmit="return check(this)">
           <table border="0">
              <tr>
                 <td colspan="2">"打印表格"</td>
              </tr>
             <tr><td>输入打印表格的行数</td>
             <td><input type="Text" name="rows"></td>
             </tr>
              <tr><td>输入打印表格的列 数</td> 
             <td><input type="Text" name="cols"></td>
             </tr>
             <tr>
               <td colspan="2">
                 <input type ="submit" value="打印">
                 <input type="reset" value="重置">
               </td>
             </tr>
         
        
        </form>
    View Code
  • 相关阅读:
    C#高级编程第11版
    做点字符串题
    Codeforces Round #681 (Div. 1, based on VK Cup 2019-2020
    Educational Codeforces Round 97 题解
    AtCoder Regular Contest 106 题解
    Kick Start Round G 2020 题解
    CCSP 2020题解
    Codeforces Round #675 (Div. 2) 题解
    AtCoder Regular Contest 104
    Kick Start Round F 2020 题解
  • 原文地址:https://www.cnblogs.com/zhugexiaobei/p/3186320.html
Copyright © 2011-2022 走看看