Input + Css + Javascript 特效

來源:互聯網
上載者:User

<style>
<!--
.sffocus {
 BORDER-RIGHT: #1d95c7 1px solid; BORDER-TOP: #1d95c7 1px solid; BACKGROUND: #eef2ff; BORDER-LEFT: #1d95c7 1px solid; BORDER-BOTTOM: #1d95c7 1px solid
}
 TEXTAREA:unknown {
 BORDER-RIGHT: #1d95c7 1px solid; BORDER-TOP: #1d95c7 1px solid; BACKGROUND: #eef2ff; BORDER-LEFT: #1d95c7 1px solid; BORDER-BOTTOM: #1d95c7 1px solid
}
INPUT:unknown {
 BORDER-RIGHT: #1d95c7 1px solid; BORDER-TOP: #1d95c7 1px solid; BACKGROUND: #eef2ff; BORDER-LEFT: #1d95c7 1px solid; BORDER-BOTTOM: #1d95c7 1px solid
}
INPUT {
 BORDER-RIGHT: #999 1px solid; BORDER-TOP: #999 1px solid; MARGIN: 0px; BORDER-LEFT: #999 1px solid; BORDER-BOTTOM: #999 1px solid
}
TEXTAREA {
 BORDER-RIGHT: #999 1px solid; BORDER-TOP: #999 1px solid; MARGIN: 0px; BORDER-LEFT: #999 1px solid; BORDER-BOTTOM: #999 1px solid
}
 
 -->
</style>

<SCRIPT>
<!--

function suckerfish(type, tag, parentId)
{
 if (window.attachEvent)
 {
  window.attachEvent("onload", function()
  {
   var sfEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);
   type(sfEls);
   });
  }
 }
 
 sfFocus = function(sfEls) {
  for (var i=0; i<sfEls.length; i++)
   {
   sfEls[i].onfocus=function()
     {
    this.className+=" sffocus";
    }
   sfEls[i].onblur=function()
     {
    this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
    }
  }
}
suckerfish(sfFocus, "INPUT");
suckerfish(sfFocus, "TEXTAREA");
//-->
</SCRIPT>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.