首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

写一段代码老是说什么缺少括号,郁闷!高手救急等急

2012-01-15 
写一段代码老是说什么缺少括号,郁闷!!高手救急?在线等等急!!functionpasswordstrength(showed){this.showe

写一段代码老是说什么缺少括号,郁闷!!高手救急?在线等等急!!
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.setSize=function(w,h)
{
this.height=h;
this.width=w;
}
//设置长度


passwordstrength.prototype.setLength=function(n)
{
if(isNaN(n))
{
return
}
var   n=Number(n);
if(n> 1)
{
this.minlength=n;
}
}
passwordstrength.prototype.update=function(s)
{
if(s.length <this.minlen)
{
return   ;
}
var   la=-1;
if(s.match(/[a-z]/ig))
{
la++;
}
if(s.match(/[0-9]/ig))
{
la++;
}
if(s.match(/(.[^a-z0-9])/ig))
{
la++;
}
switch(la)
{
case   0   :
this.copyStyle(1);
break;
case   1:
this.copyStyle(2);
break;
case   2:
this.copyStyle(3);
break;
default   :
this.copyStyle(0);

}
}

[解决办法]
太长,没细看

passwordstrength.prototype.copyToObject=function(o1,o2);

后面的;去掉试下

热点排行