form表單:
input的基本屬性:
一、action
屬性規定當提交表單時,向何處發送表單資料,
二、 type
(1)type的屬性值可以設定為:
- checked:默認被選擇
例:<input type="radio" name="xingbie" checked="checked">
- checkbox:復選框
例:<input type="checkbox" name="">
- radio:單選框
例:<input type="radio" name="">
- password:輸入文字被隱藏 / 密碼
例:<input type="password" >
- text:文本
例:<input type="text" value="">
- 輸入時間:date
例:<input type=“date”>
- 輸入顏色:color
例:<input type="color">
- button:按鈕
例:<input type=“button” value(顯示按鈕上的文字)=“”>
- reset:重置按鈕
例:<input type=“reset” value(顯示按鈕上的文字)=“”>
- submit:提交按鈕
例:<input type=“submit” value(顯示按鈕上的文字)=“”>
- 輸入數字number(不能輸入別的)
例:<input type=“number”>
注意!!!!!
<input type="checkbox"> 和 <input type="radio"> 中必須設定 value 屬性,
value 屬性無法與 <input type="file"> 一同使用,
(2)對于不同的輸入型別,value 屬性的用法也不同!!!!:
- type=“button”, “reset”, “submit”----定義按鈕上的顯示的文本
1.代碼展示
<input type="submit" value="搜索">
<input type="button" value="提交">
<input type="reset" value="我是">
結果:

- type=“text”, “password”, “hidden” ---- 定義輸入欄位的初始值
- 代碼展示
<input type="text" value="搜索">
<input type="password" value="提交">
<input type="hidden" value="我是">
- 結果

- type=“checkbox”, “radio”, “image” ---- 定義與輸入相關聯的值
- 代碼展示
<input type="checkbox" value="搜索">
<input type="radio" value="提交">
<input type="image" value="我是">
- 結果

三、 value
屬性為 input 元素設定值,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/4332.html
標籤:其他
上一篇:快速入門云開發
