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>

  • 相关阅读:
    Google's Innovation Factory (and how testing adapts)
    虎年拜年帖
    [ZZ]让测试也敏捷起来
    Selenimu做爬虫续
    OKR的解说
    春秋航空的机上店铺
    免费TK域名试用
    快速排序_C语言实现
    第一篇博客
    C、C++代码格式优化软件献给编程爱好者
  • 原文地址:https://www.cnblogs.com/vonk/p/3975357.html
Copyright © 2011-2022 走看看