在网页中使用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.\n'+
           '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>

上一篇:如何把 excel 的数据导入到数据库里面去


下一篇:Sql中判断"库、表、列,视图,存储过程"是否存在