gpt4 book ai didi

javascript - 如何更改 javascript 中的宽度属性?

转载 作者:太空宇宙 更新时间:2023-11-03 19:39:43 24 4
gpt4 key购买 nike

我在 chrome 浏览器开发者模式下手动更改了 style 属性,达到了预期的效果。通过输入

element.style {
width: 900px;
}

之后操作的 div 显示为:

<div id="rte-savebar" class="aui-toolbar" style="width: 900px;">

现在我正在尝试使用此命令对 javascript 产生相同的效果:

document.getElementById("rte-savebar").style="width:900px;";

这似乎完全没有效果。

我需要做什么才能在 javascript 中更改宽度?

最佳答案

document.getElementById("rte-savebar").style.width = "900px";

关于javascript - 如何更改 javascript 中的宽度属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15138410/

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