最常见占位符演示
最常见的占位符,触发后隐藏
XML/HTML Code
- <form><link href="css/style.min.css" rel="stylesheet" />
- <label class="fade">
- <input name="field1" placeholder="触发/模糊焦点" />
- <div class="arrow"></div>
- </label>
- <label class="fade">
- <textarea name="field2" placeholder="输入或textareas"></textarea>
- <div class="arrow"></div>
- </label>
- </form>
JavaScript Code
- <script type="text/javascript">
- <!--占位符演示代码-->
- Placeholdem(document.querySelectorAll('[placeholder]'));
- <!--页面打开淡出淡进/可无视-->
- var fadeElems = document.body.querySelectorAll('.fade'),
- fadeElemsLength = fadeElems.length,
- i = 0,
- interval = 50;
- function incFade(){
- if(i < fadeElemsLength){
- fadeElems[ i ].className += ' fade-load';
- i++;
- setTimeout(incFade, interval);
- }
- }
- setTimeout( incFade, interval );
- </script>
原文地址:http://www.freejs.net/article_biaodan_919.html