我想使用 javascript dom 更改我的 div 标签的边框图像
你可以这样做:
var dv = document.getElementById('#divID');
dv.style.borderImage = 'url(border.png) 30 30 round';
dv.style.MozBorderImage = 'url(border.png) 30 30 round';
dv.style.WebkitBorderImage = 'url(border.png) 30 30 round';
dv.style.OBorderImage = 'url(border.png) 30 30 round';
如果你想为所有 DIV 做:
var dvs = document.getElementsByTagName('div');
for (var i = 0; i < dvs.length; i++) {
dvs[i].style.borderImage = 'url(border.png) 30 30 round';
dvs[i].style.MozBorderImage = 'url(border.png) 30 30 round';
dvs[i].style.WebkitBorderImage = 'url(border.png) 30 30 round';
dvs[i].style.OBorderImage = 'url(border.png) 30 30 round';
}