[英]Javascript only works with an alert
我写了一些Java脚本,这些脚本使用FormAPI for Teamsite遍历xml节点,并从其中一个节点中删除了一个值。 removeID函数仅在警报处于其中时才能正常工作。 我试过将动作分成不同的函数,并在它们上放置setTimeout(),但没有任何效果。 该脚本仅在保存和关闭页面时执行,因此该页面肯定已经加载。 还有其他想法吗?
这有效:
function removeID(xPath) {
if(xPath.getChildByName('path') != undefined && xPath.getChildByName('id') != undefined){
if(xPath.getChildByName('path').getValue() == "" && xPath.getChildByName('id').getValue() != ""){
xPath.getChildByName('id').setValue('');
alert("replaced ");
}
}
return true;
}
这不起作用(无警报):
function removeID(xPath) {
if(xPath.getChildByName('path') != undefined && xPath.getChildByName('id') != undefined){
if(xPath.getChildByName('path').getValue() == "" && xPath.getChildByName('id').getValue() != ""){
xPath.getChildByName('id').setValue('');
}
}
return true;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.