日期:2014-05-19  浏览次数:20720 次

写一段代码老是说什么缺少括号,郁闷!!高手救急?在线等等急!!
function   passwordstrength(showed)
{
this.showed=(typeof(showed)== "boolean ")?showed:true;
this.style[0]={backgroudColor: "#000000 ",borderLeft: "solid   1px   #ffffff ",borderRight: "solid   1px   #000000 ",borderButtom: "solid   1px   #000000 "};
this.style[1]={backgroudColor: "#kkkkkk ",borderLeft: "solid   1px   #ffffff ",borderRight: "solid   1px   #kkkkkk ",borderButtom: "solid   1px   #kkkkkk "};
this.style[2]={backgroudColor: "#aaaaaa ",borderLeft: "solid   1px   #ffffff ",borderRight: "solid   1px   #aaaaaa ",borderButtom: "solid   1px   #aaaaaa "};
this.style[3]={backgroudColor: "#bbbbbb ",borderLeft: "solid   1px   #ffffff ",borderRight: "solid   1px   #bbbbbb ",borderButtom: "solid   1px   #bbbbbb "};

this.divName= "pwd_div_ "+Math.ceil(Math.random()*1000000);

this.minlen=6;
this.selectedIndex=0;
this.width= "200px ";
this.height= "16px ";
this.lables=[ "弱 ", "中 ", "强 "];
this.content= " ";

this.init();
}
passwordstrength.prototype.init=function()
{
var   s= ' <table   id= " '+divName+ '_table "   callspacing= "0 "   cellpadding= "0 "   style= "width: '+this.width+ ';height: '+this.height+ '; "   > ';
s+= ' <tr> ';
for(var   i=0;i <3;i++)
{
s+=   ' <td   id= " '+this.divName+ '_td_ '+i+ ' "   width= "33% "   align= "center "> <span   style= "font-size:1px "> &nbsp: </span> <span   id= " '+this.divName+ '_lable_ '+i+ ' "   style= "display:none;font-family:Courier   New,Courier,mono;font-size:12px;color:#000000; "> '+this.lables[i]+ ' </span> </td> ';
}
s+= ' </tr> ';
s+= ' </table> ';
alert(s);
this.content=   s   ;
if(this.showed)
{
document.write(s);
copyStyle(this.selectedIndex);
}
}
passwordstrength.prototype.copyStyle=function(id)
{
this.selectedIndex=id;
for(var   i=0;i <3;i++)
{
if(i   ==   id-1)
{
this.$(this.divName+ "_lable_ "+i).style.display= "inline ";
}
else
{
this.$(this.divName+ "_lable_ "+i).style.display= "none ";
}
}
for(var   i=0;i <id;i++)
{
this.$copyToObject(this.styles[i],this.$(divName+ "_td_ "+i).style);
}
for(;i <3;i++)
{
this.$copyToObject(this.styles[0],this.$(divName+ "_td_ "+i).style);
}
}

passwordstrength.prototype.$=function(s)
{
  return   document.getElementById(s);
}

passwordstrength.prototype.copyToObject=function(o1,o2);
{
for(var   i   in   o1)
{
o2[i]=o1[i];
}
}

//设置大小
passwordstrength.prototype.s