zoukankan      html  css  js  c++  java
  • 在网页中使用javascript提供反馈信息

    一,使用document.write()

    二,使用window方法,prompt(),alert()和confirm()

    <html lang="en">
    <head>
      <title>Search example</title>
    <script type="text/javascript">
    function checkSearch()
    {
           if(!document.getElementById||!document.createTextNode){return;}
           if(!document.getElementById('search')){return;}    //通过元素的ID特性来获取元素
           var searchValue=document.getElementById('search').value;
           if(searchValue=='')
           {
               alert('Please enter a search term');
               return false;
           }
           else if(searchValue=='JavaScript')
           {
               var really=confirm('"JavaScript" is tt very common term. '+
               'Do you really want to search for this?');
               return really;
           }
           else
           {
               return true;
           }
    }
    </script>
    </head>
    <body>
      <form action="sitesearch.php" method="post" onsubmit="return checkSearch()">
      <p>
      <label for="search">Search the site:</label>
      <input type="text" id="search" name="search"/>
      <input type="submit" value="Search"/>
      </p>
      </form>
    </form>
    </body>
    </html>

  • 相关阅读:
    生成Ipa安装包的plist文件后生成下载链接
    ssh_key登录服务器,免密码登录
    Ruby中类的进阶(继承,private, public, protect)
    Ruby中的类
    Redis- redis.conf
    Active Job 基础
    rails框架配置
    rails中使用CarrierWave实现文件上传的功能
    Flask-SQLAlchemy
    Linux自动共享USB设备:udev+Samba
  • 原文地址:https://www.cnblogs.com/vonk/p/3975357.html
Copyright © 2011-2022 走看看