<!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>无标题文档</title> <script type="text/javascript"> function check(flag){ var name2=document.formname.name1; var password2=document.formname.password1; if(name2.value==""){ alert("用户名不能为空"); name2.focus(); return false; } if(password2.value==""){ alert("密码不能为空") password2.focus(); return false; } if(flag==1){ document.formname.action="5秒后跳转.html"; }else if(flag==2){ document.formname.action="123.jsp"; } document.formname.submit(); } </script> </head> <body> <form name="formname" method="post" "> 用户名:<input type="text" name="name1" /><br /> 密码:<input type="password" name="password1" /><br /> <input type="button" value="登陆" onclick="check(1)"/> <input type="button" value="注册" onclick="check(2)" /> </form> </body> </html>
时间: 2024-10-07 15:46:55