通过超链接提交表单
第一種方式
<script LANGUAGE = " JavaScript " >
?? function? checkvalue()
???? {
???? if (document.welcomeform.username.value == "" )
?????? {
????? ? alert( " 用戶名不能為空! " );
???? ?? return ( false );
???? }
???? if (document.welcomeform.password.value == "" )
????? {
?????? alert( " 密碼不能為空! " );
????? ?return ( false );???
??? }
?? document.welcomeform.submit();
??? return ( true );??
?}
? </script >
?
? <body>
?<form name = " welcomeform "? method = " post "? action = " welcome.action " >
????? <input type="text" name="username" />
????? <input type="text" name="password"/>
??????<a href = " # "? onclick = " javascript:checkvalue();return false: " > 登錄?? </a >
? </form >?
? </ body >
第二種方式
<form name="welcomeform" method="post" action="welcome.action">
<input type=text>
</form>
<a href="javascript:welcomeform.submit();">提交</a>
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀
總結
- 上一篇: 开发完整J2EE解决方案的八个步骤
- 下一篇: 在JSP客户端限制表单重复提交