首页 > 代码库 > html 前台通用表单

html 前台通用表单

<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
	function validate() {
		if(loginform.username.value =http://www.mamicode.com/=""){
			alert("账号不能为空!");
			return;
		}
		if(loginform.password.value =http://www.mamicode.com/=""){
			alert("密码不能为空!");
			return;
		}
		loginform.submit();
	}
	</script>
</head>
<body>
	<form action="test" method="post" name="loginform">
		用户名:<input type="text" name="username"><br>

		密码: <input type="password" name="password"><br>

		性别:<input type="radio" name="sex" value="http://www.mamicode.com/boy" checked="true">男
		<input type="radio" name="sex" value="http://www.mamicode.com/girl">女<br>

		家乡:<select name="home">
			<option value="http://www.mamicode.com/beijing">北京</option>
			<option value="http://www.mamicode.com/shanghai">上海</option>
			<option value="http://www.mamicode.com/guangdong">广东</option>
		</select><br>

		隐藏域:<input type="hidden" name="page"><br>

		个人信息:<textarea name="info" cols="30" rows="10"></textarea><br>

		爱好:<input type="checkbox" name="fav" value="http://www.mamicode.com/sing">唱歌
		<input type="checkbox" name="fav" value="http://www.mamicode.com/dance">跳舞
		<input type="checkbox" name="fav" value="http://www.mamicode.com/ball">打球
		<input type="checkbox" name="fav" value="http://www.mamicode.com/game">打游戏<br>

		<select name="hobby" multiple="true">
			<option value="http://www.mamicode.com/sing">唱歌</option>
			<option value="http://www.mamicode.com/dance">跳舞</option>
			<option value="http://www.mamicode.com/ball">打球</option>
			<option value="http://www.mamicode.com/game">打游戏</option>
		</select><br>

		号码1:<input type="text" name="phone"><br>
		号码2:<input type="text" name="phone"><br>
		号码3:<input type="text" name="phone"><br>
		号码4:<input type="text" name="phone"><br>
		号码5:<input type="text" name="phone"><br>

		<input type="submit" value="http://www.mamicode.com/查询">
		
		<input type="button" value="http://www.mamicode.com/验证查询" onclick="validate()">
	</form>
</body>
</html>


效果图例如以下: