1. 程式人生 > >html input標籤 單行文字框

html input標籤 單行文字框

input type屬性
text 單行文字框
passworld 密碼文字框
button 按鈕

reset

重置按鈕
image 影象形式的提交按鈕
radio 單選按鈕
checkbox 複選框
hidden 隱藏欄位
file

檔案上傳

語法:    <input type="表單型別">

單行文字框

語法:    <input type="text">

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
</head>
<body>

    <form name="my_Form" method="POST">
        姓名:<input type="text">
    </form>

</body>
</html>

text 幾個重要屬性

value : 定義文字框的預設值,也就是文字框內的文字

siae : 定義文字框的長度,以字元為單位

maxlength : 設定文字框中最多可以輸入的字元數

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
</head>
<body>

    <form name="my_Form" method="POST">
        姓名:<input type="text" value="zql" size="15" maxlength=""><br>
        年齡:<input type="text" value="18" size="15" maxlength="3">
    </form>

</body>
</html>