1
On Error Resume Next
    frmDetail.Description<%=nLineCount%>.readonly = False
    frmDetail.DetailedDescription<%=nLineCount%>.readonly = False
On Error GoTo 0

我有上面的vb脚本代码段。我需要将其转换为 java 脚本。我该怎么做 ?

4

1 回答 1

3
// The direct translation:

try {
    frmDetail.Description<%=nLineCount%>.readonly = false;
} catch(err) {}

try {
    frmDetail.DetailedDescription<%=nLineCount%>.readonly = false;
} catch(err) {}



// The right way:

if (frmDetail)
{
    if (frmDetail.Description<%=nLineCount%>){
        frmDetail.Description<%=nLineCount%>.readonly = false;
    }
    if (frmDetail.DetailedDescription<%=nLineCount%>){
        frmDetail.DetailedDescription<%=nLineCount%>.readonly = false;
    }
}
于 2012-12-19T11:37:55.850 回答