mootools设置点击全部文本框时变化颜色

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<title>30 days of moo - day 1</title>
<link rel=stylesheet href="css/main.css" type="text/css" media=screen>
<script src="js/mootools1.2.js" type="text/javascript"></script>
<script type="text/javascript">
function  EditColor()
{
 var o = new Object();
 o.oldColor = "";//每次保存老的颜色
 o.curColor = "#FF0000";//默认颜色

 o.setBackColor = function(event){//设置颜色
  o.cObj = event.target;
  o.cStyle = o.cObj.get("type");
  if(o.cStyle!="checkbox" && o.cStyle!="radio" && o.cStyle!="button"){
   o.oldColor = o.cObj.getStyle("background-color");
   o.cObj.setStyle("background-color",o.curColor);
  }
 };
 o.backBackColor = function(event){//归回原来颜色
  o.cObj = event.target;
  o.cStyle = o.cObj.get("type");
  if(o.cStyle!="checkbox" && o.cStyle!="radio" && o.cStyle!="button"){
   o.cObj.setStyle("background-color",o.oldColor);
  }
 };
 o.setCurColor = function(paramColor){//设置新的颜色
  o.curColor = paramColor;
 };
 o.fullObjes = $$("input");
 o.fullArea = $$("textarea");
 o.fullObjes.combine(o.fullArea);
 o.fullObjes.addEvent("focus",o.setBackColor);
 o.fullObjes.addEvent("blur",o.backBackColor);
 return o;
};
window.addEvent('domready',function(){
 var col = new EditColor();
 col.setCurColor("#003990");
});
window.addEvent('domready',function(){
 alert();
});
</script>  
</head>
<body>
<input type="Checkbox" /><br>
<input type="radio" /><br>
<textarea ></textarea><br>
<input id="me" style="background:yellow"/><br>

<textarea ></textarea><br>
<input id="netTween_set" type="button" value=" 按钮 "/>
</body>
</html>

你可能感兴趣的:(mootools设置点击全部文本框时变化颜色)