亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

全局計數變量不增加

全局計數變量不增加

慕尼黑8549860 2023-09-28 17:26:07
由于某種原因,我無法讓全局變量計數器增加,即使它在發生 count++ 的函數內增加也是如此。我的輸出結果在函數內輸出的文本和函數外部的文本之間是不同的。知道我在這里做錯了什么嗎?Survey.oncomplete 函數結果的每次迭代計數不應該增加嗎?Survey    .StylesManager    .applyTheme("modern");var kn2 = "LwrHXqFRN_pszCopTKHF_Q"var kn3 = "exroCUoYl4wVzs7pKU_49w"var count = 0var keyname = ("kn" + count)var mapilink = "https://images.mapillary.com/" + (keyname) + "/thumb-1024.jpg";var json = { pages: [  {   name: "page1",   elements: [    {     type: "image",     name: "image",     imageLink: (mapilink),     imageHeight: 580,     imageWidth: 640    },    {     type: "html",     name: (keyname),     visible: false,     html: (keyname)    },    {     type: "rating",     name: "Walkability",     title: "How walkable does this look to you"    },    {     type: "rating",     name: "Saftey",     title: "How safe does this look to you"    },    {     type: "rating",     name: "Comfortability",     title: "How comfortable does this look to you"    }   ]  } ]}window.survey = new Survey.Model(json);var username = document.getElementById("user").value;survey    .onComplete    .add(function (result) {        count ++;        var PID = document.getElementById("user").value;        var results = PID + "_" + (keyname) + ":\n" + JSON.stringify(result.data, null, 3) + (count) ;        document            .querySelector('#surveyResult')            .textContent = results;    survey.clear();    survey.render();    });$("#surveyElement").Survey({model: survey});
查看完整描述

1 回答

?
Cats萌萌

TA貢獻1805條經驗 獲得超9個贊

?基本上,需要將所有內容包裝在更多函數中。

函數輸出函數文本而不是預期輸出


查看完整回答
反對 回復 2023-09-28
  • 1 回答
  • 0 關注
  • 127 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號