进度条问题

Lion_wen666 2012-03-31 08:55:31
我使用动态改变图片的宽度来显示加载进度,但加载过程中,图片不断出现闪动(加载到50%时,宽从1%到50%,而不是从49到50%),请问如何解决?
document.getElementById("imgBar").style.width = temp;
...全文
69 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
习惯就好 2012-04-01
  • 打赏
  • 举报
回复


看到问题,我想到了一个方法你可以试一试

<div id="total" style="background-color:red;height:20px;width:800px;">
<div id="currentStatue" style="background-color:blue;height:20px;width:500px;"> <div/>
</div>

动态控制currentStatue的宽度即可
Lion_wen666 2012-03-31
  • 打赏
  • 举报
回复
<head runat="server">
<title></title>
<script language="javascript" >
var timer = null;
function returnresponse() {
urls = "ajaxguagedemo.aspx?guage=1";
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.open("GET", urls, true);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
temp = xmlHttp.responseText;
//document.getElementById("imgBar").style.width = temp;
document.getElementById("ddf").style.width = temp;
document.getElementById("laPercent").innerText = temp;
if (temp == "100%") {
clearTimeout(timer);
}
else {
document.getElementById("ddf").style.width = temp;
document.getElementById("laPercent").innerText = temp;
}
}
}
xmlHttp.send(urls);
}
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="butShowGuestInfo" runat="server" Text="star"
onclick="butShowGuestInfo_Click" /><label id="laPercent">12</label>
<div style="background-color:Blue; width:200px;" id="ddf"><%--<img src="img/guide_actived.gif" style=" height:22px;" id="imgBar" border="0" />--%></div>

<%=loadBar%>
</div>
</form>
</body>
</html>
色拉油 2012-03-31
  • 打赏
  • 举报
回复
贴代码

62,267

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧