<!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> <title> new document </title> <meta http-equiv = "content-type" content ="text/html;charset=utf-8" /> <meta name="keywords" content=""> <meta name="description" content=""> </head> <body onload = "dosomething()"> <form onsubmit = "return oncheck();"> <p><label for="username">用户名:</label><input type="text" name="username" id="username" onfocus = "this.value = '';" onblur="if(this.value == '')alert('用户名不能为空');" value="请输入你的用户名" /></p> <p><label for="pwd">密码:</label><input type="password" name="pwd" id="pwd" ></p> <p><input type="checkbox" id="re" name="re" onclick = "alert('你选择了记住密码')" ><label for="re">记住密码</label></p> <p> <input type="submit" name="" value="登录" /> <input type="reset" name="pwd" value="取消"> </p> </form> <script type="text/javascript"> function dosomething(){ alert("页面加载完成,欢迎来到登录页面"); } function oncheck(){ if( confirm("确定提交登录吗?") ){ return true; }else{ return false; } } </script> </body> </html>