Input + Css + Javascript 特效

<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>

posted @ 2006-12-13 11:30  Winner.Net(2007)  阅读(430)  评论(0编辑  收藏  举报