国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

<input>

HTML <input> 標(biāo)簽 實例 一個簡單的 HTML 表單,包含兩個文本輸入框和一個提交按鈕: <form action='demo_form.asp'> First name: <input type='text' name='fname'>..


HTML <input> 標(biāo)簽

實例

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文網(wǎng)(php.cn)</title> 
</head>
<body>

<form action="demo-form.php">
First name: <input type="text" name="FirstName" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>
<input type="submit" value="提交">
</form>

<p>點擊"提交"按鈕,表單數(shù)據(jù)將被發(fā)送到服務(wù)器上的“demo-form.php”。</p>

</body>
</html>

運行實例 ?

點擊 "運行實例" 按鈕查看在線實例


瀏覽器支持

1000.png

目前大多數(shù)瀏覽器支持 <input>標(biāo)簽。


標(biāo)簽定義及使用說明

<input> 標(biāo)簽規(guī)定了用戶可以在其中輸入數(shù)據(jù)的輸入字段。

<input> 元素在 <form> 元素中使用,用來聲明允許用戶輸入數(shù)據(jù)的 input 控件。

輸入字段可通過多種方式改變,取決于 type 屬性。


提示和注釋

注意: <input> 元素是空的,它只包含標(biāo)簽屬性。

提示: 你可以使用 <label> 元素來定義 <input> 元素的標(biāo)注。


HTML 4.01 與 HTML5之間的差異

在 HTML 4.01 中, "align" 數(shù)據(jù)已經(jīng)不再使用。HTML5 中不支持該屬性。 可以使用CSS來定義 <input> 元素的對齊方式。

在 HTML5中,  <input> 添加了幾個屬性,并且添加了對應(yīng)的值。


HTML 與 XHTML 之間的差異

在 HTML 中,<input> 標(biāo)簽沒有結(jié)束標(biāo)簽。

在 XHTML 中,<input> 標(biāo)簽必須被正確地關(guān)閉。


屬性

New :  HTML5新標(biāo)簽。

屬性描述
acceptaudio/* video/* image/*MIME_type規(guī)定通過文件上傳來提交的文件的類型。 (只針對type="file")
alignleft right top middle bottomHTML5已廢棄,不贊成使用。規(guī)定圖像輸入的對齊方式。 (只針對type="image")
alttext定義圖像輸入的替代文本。 (只針對type="image")
autocompleteNewon offautocomplete 屬性規(guī)定 <input> 元素輸入字段是否應(yīng)該啟用自動完成功能。
autofocusNewautofocus屬性規(guī)定當(dāng)頁面加載時 <input>  元素應(yīng)該自動獲得焦點。
checkedcheckedchecked 屬性規(guī)定在頁面加載時應(yīng)該被預(yù)先選定的  <input> 元素。 (只針對 type="checkbox" 或者 type="radio")
disableddisableddisabled 屬性規(guī)定應(yīng)該禁用的 <input> 元素。
formNewform_idform 屬性規(guī)定 <input> 元素所屬的一個或多個表單。
formactionNewURL屬性規(guī)定當(dāng)表單提交時處理輸入控件的文件的 URL。(只針對 type="submit" 和 type="image")
formenctypeNewapplication/x-www-form-urlencoded multipart/form-data text/plain屬性規(guī)定當(dāng)表單數(shù)據(jù)提交到服務(wù)器時如何編碼(只適合 type="submit" 和 type="image")。
formmethodNewget post定義發(fā)送表單數(shù)據(jù)到 action URL 的 HTTP 方法。 (只適合 type="submit" 和 type="image")
formnovalidateNewformnovalidateformnovalidate 屬性覆蓋 <form> 元素的 novalidate 屬性。
formtargetNew_blank _self _parent _topframename規(guī)定表示提交表單后在哪里顯示接收到響應(yīng)的名稱或關(guān)鍵詞。(只適合 type="submit" 和 type="image")
heightNewpixels規(guī)定  <input>元素的高度。(只針對type="image")
listNewdatalist_id屬性引用  <datalist> 元素,其中包含 <input> 元素的預(yù)定義選項。
maxNewnumber date屬性規(guī)定 <input> 元素的最大值。
maxlengthnumber屬性規(guī)定 <input> 元素中允許的最大字符數(shù)。
minNewnumber date屬性規(guī)定 <input>元素的最小值。
multipleNewmultiple屬性規(guī)定允許用戶輸入到 <input> 元素的多個值。
nametextname 屬性規(guī)定 <input> 元素的名稱。
patternNewregexppattern 屬性規(guī)定用于驗證 <input> 元素的值的正則表達式。
placeholderNewtextplaceholder 屬性規(guī)定可描述輸入 <input> 字段預(yù)期值的簡短的提示信息 。
readonlyreadonlyreadonly 屬性規(guī)定輸入字段是只讀的。
requiredNewrequired屬性規(guī)定必需在提交表單之前填寫輸入字段。
sizenumbersize 屬性規(guī)定以字符數(shù)計的  <input> 元素的可見寬度。
srcURLsrc 屬性規(guī)定顯示為提交按鈕的圖像的 URL。 (只針對 type="image")
stepNewnumberstep 屬性規(guī)定 <input> 元素的合法數(shù)字間隔。
typebutton
checkbox
color
date
datetime
datetime-local
email
file
hidden
image
month
number
password
radio
range
reset
search
submit
tel
text
time
url
week
type 屬性規(guī)定要顯示的  <input> 元素的類型。
valuetext指定 <input> 元素 value 的值。
widthNewpixelswidth 屬性規(guī)定  <input> 元素的寬度。  (只針對type="image")


全局屬性

<input> 標(biāo)簽支持全局屬性,查看完整屬性表 HTML全局屬性。


事件屬性

<input> 標(biāo)簽支持所有 HTML事件屬性。