<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>判断是否为空</title> <script language="javascript"> function testnull() { if (document.getElementById('airline').value=='') { alert('输入不能为空'); document.getElementById('airline').focus(); } } </script> </head> <body> 输入框:<input type="text" name="airline" id="airline" style="width: 200px;" placeholder="输入不用为空"><br> <input type="button" οnclick="testnull()" value="记录"style="background-color: blueviolet"/><br><br> </body> </html>
input是否为空
最新推荐文章于 2022-01-17 15:40:35 发布