今天举个用超链接的方式实现提交表单的例子,有时候很有作用哦,以下是示例:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>用超链接的方式实现提交表单的例子</title> </head> <body> <script LANGUAGE="JavaScript"> function checkvalue() { if(document.welcomeform.myname.value=="") { alert("昵称不能为空!"); return(false); } if(document.welcomeform.mypassword.value=="") { alert("密码不能为空!"); return(false); } document.welcomeform.submit(); return(true); } </script> <form name="welcomeform" method="post" action="index.php"> 昵称:<input type="text" name="myname" value=""> 密码:<input type="password" name="mypassword" value=""> <a href="#" onclick="JavaScript:checkvalue();return false;">登录</a> </form> </body> </html>
提示:你可以先修改部分代码再运行。
还没有任何评论。
这篇文章上的评论的 RSS feed TrackBack URL
名称 (必填)
电子邮件 (不会被公开) (必填)
网站
Powered by WordPress