文本内容提示效果,未输入内容时显示文本内容,点击输入时内容后消失,由于是IE8,所以无法利用placeholder实现效果:<input  placeholder="提示语"/>,利用js实现该效果

//给出提示:原因+出行人员
         var tit=document.getElementById("whir$t3371_f7764").value;
         if(tit==""){
             document.getElementById("whir$t3371_f7764").innerText="事由+出行人员";
         }
         var tis=document.getElementById("whir$t3371_f7764");
         tis.onfocus=function(){
        if(this.value=='事由+出行人员'){
          this.value='';
          
        };
      };
       tis.onblur=function(){
        if(!this.value){
          this.value = '事由+出行人员';
        };
      };

 

<input id="whir$t3371_f7764" value="事由+出行人员">

posted on 2018-08-09 11:39  regretDeeply  阅读(96)  评论(0编辑  收藏  举报