我的DivTest和IdOtherDIV宽度相同。
我正在尝试这样设置属性:
DivTest {
background: #007C52;
width: document.getElementById ("IdOtherDIV").scrollWidth + "px.\n";
}
有没有办法实现它(IdOtherDIV是动态创建的,宽度可以在每次页面刷新时改变)?
答案 0 :(得分:0)
您可以使用jquery
width=$("IdOtherDiv").css("width");
$("#DivTest").css({"background":"007C52","width":width})