zoukankan      html  css  js  c++  java
  • javascript prompt示例

    <html lang="en">
    <head>
      <title>Date example</title>
    <script type="text/javascript">
    function checkDate()
    {
    if(!document.getElementById||!document.createTextNode){return;}
    if(!document.getElementById('date')){return;}
    var checkPattern=new RegExp("\d{2}/\d{2}/\d{4}");
    var dateValue=document.getElementById('date').value;
    if(dateValue=='')
    {
    alert('Please enter a date');
    return false
    }
    else
    {
    while(!checkPattern.test(dateValue)&&dateValue!=null)
    {
    dateValue=prompt('Your date was not in the right format.'
    +'Please enter it as DD/MM/YYYY.',dateValue);
    }
    return dateValue!=null;
    }
    }
    </script>
    </head>
    <body>
      <h1>Events search</h1>
      <form action="eventssearch.php" method="post" onsubmit="return checkDate();">
       <p>
        <label for="date">Date in the format DD/MM/YYYY:</label><br/>
        <input type="text" id="date" name="date"/>
        <input type="submit" value="Check"/>
       <br/>(example 23/01/1933)
       </p>
      </form>
    </body>
    </html>

  • 相关阅读:
    k8s-存储-volume
    k8s-存储-configmap
    k8s-集群调度
    k8s-常用命令
    k8s-资源限制
    k8s-更改证书时间
    kubeadmin安装k8s
    CCPC-Wannafly Winter Camp Day7 D---二次函数【数论】【构造】
    洛谷P1219 八皇后【dfs】
    2019寒假计数器
  • 原文地址:https://www.cnblogs.com/vonk/p/3975412.html
Copyright © 2011-2022 走看看