0
div
{
border-image:url(border.png) 30 30 round;
-moz-border-image:url(border.png) 30 30 round; /* Firefox */
-webkit-border-image:url(border.png) 30 30 round; /* Safari and Chrome */
-o-border-image:url(border.png) 30 30 round; /* Opera */
}

我想使用 javascript dom 更改我的 div 标签的边框图像

提前致谢

4

2 回答 2

1
$('div').css({
  "border-image"           :  "url(border.png) 30 30 round",
  "-moz-border-image"      :  "url(border.png) 30 30 round",
  "-webkit-border-image"   :  "url(border.png) 30 30 round",
  "-o-border-image"        :  "url(border.png) 30 30 round"
});
于 2012-05-28T07:45:27.277 回答
0

我想使用 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';
}
于 2012-05-28T07:46:06.460 回答