使用純JavaScript,最好增加一個ID:
<img id="myImage" src="linkremoved" style="height:45px;width:45px;margin-right:10px;-webkit-border-radius: 50%;-moz-border-radius: 50%;border-radius: 50%;">
,然後使用:
document.getElementById('myImage').style.height='50px';
如果您不能添加一個id,你需要:
/**
* Get an image by it's src.
*
* Returns the first image matching the src
*/
function getImageBySrc(src) {
var images = document.getElementsByTagName('img');
for (var i in images) {
if(images[i].getAttribute('src') == src) {
return images[i];
}
}
return null;
}
// useage
var myImage = getImageBySrc('linkremoved');
myImage.style.height='50px';
你試過什麼樣的東西? –