代码如下 | 复制代码 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>js判断输入框是否为空</title> <script language="javascript"> function check() { var textvalue = document.getElentById('txt').value; if( textvalue == "" ) { alert('请输入内容'); } } function check1() { if(form1.txt.value=="" ) { alert('输入框为空,请重新输入内容提要'); } } </script> </head> <body> |
时间: 2024-10-24 00:10:44