使用 javascript 调整图像的边框宽度
Adjust border width of image using javascript
var images = document.getElementById("facilityThumbNail").getElementsByTagName("img");
for (var i = 0; i < images.length; i++) {
images[i].onmouseover = function() {
this.style.cursor = 'hand';
this.style.borderColor = 'red';
// this.style.border ? ? ? ? ?
}
}
<div id="facilityThumbNail">
<img src="https://unsplash.it/300/300" />
</div>
只是想知道是否有人可以告诉我如何通过建议属性来调整此图像的边框宽度?这不是宽度...
请指定 borderStyle
和 borderWidth
var images = document.getElementById("facilityThumbNail").getElementsByTagName("img");
for (var i = 0; i < images.length; i++) {
images[i].onmouseover = function() {
this.style.cursor = 'hand';
this.style.borderWidth = '10px';
this.style.borderStyle = 'solid';
this.style.borderColor = 'red';
}
}
<div id="facilityThumbNail">
<img src="https://unsplash.it/300/300" />
</div>
var images = document.getElementById("facilityThumbNail").getElementsByTagName("img");
for (var i = 0; i < images.length; i++) {
images[i].onmouseover = function() {
this.style.cursor = 'hand';
this.style.borderColor = 'red';
// this.style.border ? ? ? ? ?
}
}
<div id="facilityThumbNail">
<img src="https://unsplash.it/300/300" />
</div>
只是想知道是否有人可以告诉我如何通过建议属性来调整此图像的边框宽度?这不是宽度...
请指定 borderStyle
和 borderWidth
var images = document.getElementById("facilityThumbNail").getElementsByTagName("img");
for (var i = 0; i < images.length; i++) {
images[i].onmouseover = function() {
this.style.cursor = 'hand';
this.style.borderWidth = '10px';
this.style.borderStyle = 'solid';
this.style.borderColor = 'red';
}
}
<div id="facilityThumbNail">
<img src="https://unsplash.it/300/300" />
</div>