form表單元素設置只讀


form表單元素設置只讀

CreateTime--2017年5月5日11:42:41

Author:Marydon

1.設置文本框只讀

<!--  方法一:簡寫 -->
<input type="text" name="" value="文本框" class="" readonly/>
<!--  方法二:寫全 -->
<input type="text" name="" value="文本框" class="" readonly="readonly"/>

2.設置單選框只讀(禁用)

<td class="tdbiejing" nowrap="nowrap">允許調劑</td>
<td nowrap="nowrap">
    <label class="radioCss">
        <input name="isAdjust" id="" type="radio" value="" disabled
            <c:if test="${model.coumn==0 }">checked</c:if>/>
        是
    </label>                                                                        
    <label class="radioCss">
        <input name="isAdjust" id="" type="radio" value="" disabled
            <c:if test="${model==1 }">checked</c:if>/>
        否
    </label>                                                                        
</td>

3.禁用下拉列表框

<select id="" name="" nowrap="nowrap" class="TextBox" disabled>
    <option value="">選項一</option>
    <option value="">選項二</option>
    <option value="">選項三</option>
</select>

小結:

  1.標簽屬性:只讀readonly、禁用disabled、單選框&復選框默認選中checked、下拉列表框默認選中selected都可以簡寫;

  2.設置disabled屬性后,該元素的數據將無法提交,可以添加一個隱藏域

    <input id="" name="" type="hidden" value="" />。

 

 相關推薦:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM