gpt4 book ai didi

javascript - 从ajax响应增加文本框宽度值不起作用

转载 作者:行者123 更新时间:2023-11-28 06:51:59 25 4
gpt4 key购买 nike

我正在尝试实现一个进度条,我从ajax请求中获得从0到<100的增加值,并向其中添加“px”,数据正常但不适用于宽度。

enter code here
<input type="text" id="value" style="border:none;"/>
<input type="text" id="progress" style="width:0px;background-color: red;"/>

function fetchStatus()
{
xmlup=new XMLHttpRequest();
xmlup.onreadystatechange=function(){
if(xmlup.readyState === 4 && xmlup.status === 200)
{
document.getElementById("value").value=xmlup.responseText;//Working
document.getElementById("progress").style.width=xmlup.responseText+"px";
//Not Working

}
else
{
}
};
xmlup.open("GET","ProgressStatus",true);
xmlup.send();
}

最佳答案

您的脚本是正确的。

我想说样式 width 设置正确,但可能有另一个 CSS 属性(或类)阻止宽度正确显示。

关于javascript - 从ajax响应增加文本框宽度值不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32879415/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com