[英]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.