我目前左侧有
标题和图片当用户点击此链接时,会显示说明
我是这样做的:
<script type="text/javascript">
$(document).ready(function () {
$(".hidden").hide();
$("p.show").click(function () {
$(this).next(".hidden").toggle()
});
$("p.show").hover().css('cursor', 'pointer');
});
</script>
但是我想在文本出现时更改图像。我尝试使用replaceWith但是没有用。我仍然是jQuery的新手,所以任何建议都很棒。我不需要答案,只需指出什么是最好的。
<p style="color:Black;float:left;padding-top:0px;" class="show">
<img alt="+" src="resources/images/plussign.jpg" style="float:left; margin-right:10px;"/>What is EFM?<br /></p>
<div class="hidden">
<p style="margin-left:20px;">
<br />EFM, also known as Ethernet in the First Mile, is an Ethernet leased line
service that runs over copper rather than the fibre optic cable used for
other Ethernet services. The copper is provided in bonded pairs, making
the connection extremely robust. If one copper pair fails, the others remain
live, meaning you don’t suffer any downtime and can continue working with
reduced bandwidth until normal service is restored.</p>
</div>
答案 0 :(得分:0)
这样做,
<img id="myimg" alt="+" src="resources/images/plussign.jpg" style="float:left; margin-right:10px;" />
$('#mying').attr('src','nextimage');