http://akunamotata.iteye.com/blog/357593
< script LANGUAGE = " JavaScript " > function checkvalue() { if (document.welcomeform.nickname.value == "" ) { alert( " 昵称不能为空! " ); return ( false ); } if (document.welcomeform.password.value == "" ) { alert( " 密码不能为空! " ); return ( false ); } document.welcomeform.submit(); return ( true ); } < body > < form name = " welcomeform " method = " post " action = " welcome.asp " > < a href = " # " onclick = " javascript:checkvalue();return false: " > 登录 </ a > </ form > </ body >
第二种方式:
<form name="welcomeform" method="post" action="welcome.asp"> <input type=text> </form> <a href="javascript:document.welcomeform.submit();">提交</a>