0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Form 表單樣式設計與輸入驗證 By 彭彭

Posted at

WS000030.JPGWS000031.JPG

<style type="text/css">
		form{
			line-height:2em;
		}
		form>input,form>select{
			padding:5px 10px;border:1px solid #888;border-radius:5px;
		}
		form>.ok{
			color:#008800;
		}
		form>input:valid+.ok{
			display:inline;
		}
		form>input:invalid+.ok{
			display:none;
		}
    </style>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
	<title>Form 表單樣式設計與輸入 驗證</title>
	<style type="text/css">

    </style>
</head>
<body>
	<h3>zhu ce zhang hao<h3>
	<form onsubmit="alert('sent')">
		zhanghao:
			<input type="text" required placeholder="4~12 文字" pattern ="[0-9a-zAZ]{4,12}"/>
			<span class="ok">ok</span><br />
			
		password:
			<input type="password" required pattern="[0-9a-zA-Z]{8,16}"/>
			<span class="ok">ok</span><br />
			
		email:
			<input type="email" required />
			<span class="ok">ok</span><br />
			
		tel:
			<input type="text" pattern="[0-9]{8,16}" /><br />
			
		性別:
			男:<input type="radio" name="gender" value="male" required/>
			女:<input type="radio" name="gender" value="male" required/><br />
		誕生日:
			<select>
			<option value="">
			<option value="">1990</option>
			<option value="">2000</option>
			</select><br /><br />
			<input type="submit" value="send" />
	</form>
	
</body>
</html>

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?