js也是易学难精

functionRemoveControl(elements)

{

vararrObj=newArray();

varcount=elements.length;

for(vari=0;i<count;i++)

{

if(elements[i]==undefined)

continue;

varobj=document.createElement('label');

switch(elements[i].type)

{

case"text":

obj.style.width=elements[i].style.width;

obj.classname="word_warpbreak";

obj.setAttribute("innerHTML",elements[i].value);

break;

case"textarea":

obj.style.width=elements[i].style.width;

obj.classname="word_warpbreak";

obj.setAttribute("innerHTML",elements[i].innerHTML);

elements[i].innerHTML='';

break;

case"select-one":

for(varj=0;j<elements[i].length;j++)

{

if(elements[i][j].selected)

{

obj.style.width=elements[i].style.width;

obj.classname="word_warpbreak";

obj.setAttribute("innerHTML",elements[i][j].text);

break;

}

}

elements[i].options.length=0;

break;

}

elements[i].parentNode.insertBefore(obj,elements[i]);

arrObj[arrObj.length]=elements[i];

}

相关推荐