因此,我的函数根据document.load设置值更新进度条。从我所看到的,它无法呈现该元素。经过广泛的研究,我不确定为什么我的其他div可以在JS中被识别和操纵,但不能识别此特定元素;
<div id="ProgressBar">
<div id="Percentage" class="innerBar" runat="server"></div>
</div>
<script type="text/javascript">
$(document).ready(function () {
SpaceLeftVar = 32;
UpdateProgress();
});
function UpdateProgress() {
const progressBarPercentage = document.getElementById('Percentage');
const transitionProgressBar = (progress) => {
setTimeout(() => {
progressBarPercentage.style.width = progress + '%';
}, 200);
}
}
</script>
答案 0 :(得分:-1)
setTimeout(() => {
progressBarPercentage && (progressBarPercentage.style.width = progress + '%')
}, 200);