当我单击图像时,我想将该特定图像存储src
在 Javascript 变量中。我怎样才能做到这一点?请记住,<a>
标签用于悬停效果。因此,当我单击时,<a>
我想要其兄弟姐妹的图像源。
演示:http: //jsfiddle.net/FVrTg/2
<div>
<img src = "http://upload.wikimedia.org/wikipedia/commons/thumb/2/26/YellowLabradorLooking_new.jpg/260px-YellowLabradorLooking_new.jpg"/>
<a href = "#"></a>
</div>
<div>
<img src = "http://whatiscat.com/wp-content/uploads/2011/07/cute_cat_2.whatiscat.com_.jpg"/>
<a href = "#"></a>
</div>
</p>