我需要你的帮助。在论坛上找到了这个代码,我想用它:
<a id="element1" onClick="javascript:changeText(1)">Read More...</a>
function changeText(idElement) {
var element = document.getElementById('element' + idElement);
if (idElement === 1 || idElement === 2) {
if (element.innerHTML === 'Read More...') element.innerHTML = 'Close';
else {
element.innerHTML = 'Read More...';
}
}
}
是否可以通过单击来交换文本,但同时交换2张图像?
Situation 1: Read More... and image 1 shown
Situation 2: Close and image 2 shown
Situation 3: Read More... and image 1 shown