[英]Dynamically change an image on a web page
I'm having some difficulties trying to dynamically change an image. 我在尝试动态更改图像时遇到了一些困难。
<a href="#no-reload" id="dropMenuButton49" class="dropMenuButton">
<input id="searchEngineImage" type="image" src="http://example.com/image.php?i=yahoo-icon.png">
<input type="image" src="images/down.png" name="dropDown">
</a>
I need to change the first one: http://example.com/image.php?i=yahoo-icon.png . 我需要更改第一个: http : //example.com/image.php?i = yahoo-icon.png 。
Is this possible with jQuery or something else? 这可能与jQuery或其他东西?
$('#searchEngineImage').attr({'src':'some-image.jpg'});
Yes , you can change it dynamically by jquery... Check this: 是的,您可以通过jquery动态更改它...检查:
$('#searchEngineImage').attr('src', "http://some.other/image.png");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.