您现在的位置是:首页 > 电脑技术查询 > web开发

求一脚本,多谢大家啊很

编辑:chaxungu时间:2022-10-02 23:20:04分类:web开发

求一脚本,谢谢大家啊,很急
想通过一table的id,将该table内的所有input元素改成可写的,之前默认是只读

------解决方案--------------------
var objs = document.getElementById( "table1 ").getElementsByTagName( "input ");
for(var i=0;i <objs.length;i++)
{
objs[i].removeAttribute( "disabled ");
objs[i].removeAttribute( "readonly ");
}
------解决方案--------------------
function mm(tableid)
{
var inputs = document.getElementById(tableid).getElementsByTagName( "INPUT ");
for(var i=0; i <inputs.length; i++)
{
if(inputs[i].type== "text " && inputs[i].readOnly)
inputs[i].readOnly = false;
}
}