【发布时间】:2019-07-05 08:13:39
【问题描述】:
这个 JS 在 IE 上运行,但是当我使用 Chrome 时,总是出现这个错误:
异常 : TypeError: window.parent.leftframe.document.viewForm is not a function at Checked
我使用此代码检查表单输入,如果用户在该表单中输入命令,则返回 true)
你能解释一下吗?
谢谢! 文斯
function Checked()
{
if (window.parent.leftframe.document.viewForm.changed.value == "true") {
return true;
}
else {
for (k = 0; k < 30; k++) {
memcom = "member[" + i + "].command";
if (window.parent.leftframe.document.viewForm(memcom) != null && window.parent.leftframe.document.viewForm(memcom).value != "") {
return true;
}
}
return false;
}
}
viewFrom 在这个 JSP 中:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<table class="Product" cellspacing="1">
<html:form action="/viewSubmit" method="post" onsubmit="return onSubmitForm()">
<input type="hidden" name="submited" value="false">
<html:hidden property="action"></html:hidden>
<html:hidden property="changed"></html:hidden>
......
<logic:equal name="viewForm" property="opt.withMemberList" value="true">
.......
<td colspan="3" class="Product2">
<a href="#" onclick="return <bean:write name="viewForm" property="listpURL" listp="false"/>"><IMG src="images/product_list_button.gif" border="0" /></a>
</td>
.......... <tr>
<logic:iterate id="member" name="viewForm" property="members" indexId="i">
....
<html:hidden indexed="true" name="member" property="remark"></html:hidden>
<td align="location" class="Product2">
<html:select name="member" indexed="true" property="command" disabled="false">
<html:options name="member" property="commandSelection"/>
</html:select>
</td>
</tr>
......
</logic:equal>
</html:form>
</table>
</html>
Chrome 开发工具输出:
我可以在 window.parent.leftframe.document.viewForm 中看到这个
name:"member[0].command"
nextElementSibling:null
nextSibling:text
nodeName:"SELECT"
nodeType:1
nodeValue:null
nonce:""
当鼠标移到该名称时,我看到 [31].name,与其他名称相同。 如何从中获取 nodeValue ?
谢谢!
【问题讨论】:
标签: javascript function google-chrome typeerror