input date 支持placeholder屬性


第一種解決方法:IE,火狐瀏覽器,不支持input date的日歷功能,火狐支持日歷功能   ie,火狐,谷歌顯示placeholder屬性

css代碼

#dateofday:before{  color:#808080;  content:attr(placeholder);  -webkit-appearance:textarea}

html代碼

<input type="date" runat="server" placeholder="Birth Of Day"  id="dateofday"  onfocus="this.removeAttribute('placeholder')" onblur="this.setAttribute('placeholder','Birth Of Day')" />

onfocu后:                                                     onblur后:

                                   

 

第二種解決辦法:ie瀏覽器報錯  火狐不支持日歷功能  谷歌支持日歷功能, 火狐和谷歌顯示placeholder屬性

<input  type="text" placeholder="Date Of Day" onfocus="(this.type='date')"  onblur="(this.type='text')" />

onfocus后:                                  onblur后:

             

 

第三種解決方法:ie 火狐,谷歌,移動端都支持placeholder屬性,但是只有移動端和谷歌有日歷功能

<input  type="text" placeholder="Date Of Day" onfocus="this.setAttribute('type','date')"  onblur="this.setAttribute('type','text')" />

 


免責聲明!

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



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