我想在点击一个图标时禁用两个图标。然后,再次单击后,所有图标都处于活动状态。我无法想象我的生活。任何建议。我试图在单击一个时禁用两个图标。然后,再次单击后,所有图标都处于活动状态。我无法想象我的生活。任何建议。
<!--SCRIPT-->
<script language="javascript">
function pic1() {
var img = document.getElementById('img').src;
if (img.indexOf('images/pages/financing.png')!=-1) {
document.getElementById('img').src = 'images/pages/magnifying_glass.png';
document.getElementById('img2').disabled = true;
document.getElementById('img3').disabled = true;
document.getElementById("case").style.display='block';
}
else {
document.getElementById('img').src = 'images/pages/financing.png';
document.getElementById("case").style.display='none';
}
}
function pic2() {
var img = document.getElementById('img2').src;
if (img.indexOf('images/pages/check.png')!=-1) {
document.getElementById('img1').disabled = true;
document.getElementById('img3').disabled = true
document.getElementById('img2').src = 'images/pages/magnifying_glass.png';"
}
else {
document.getElementById('img2').src = 'images/pages/check.png';
document.getElementById("case").style.display='none';
}
}
function pic3() {
var img = document.getElementById('img3').src;
if (img.indexOf('images/pages/pen.png')!=-1) {
document.getElementById('img1').disabled = true;
document.getElementById('img2').disabled = true
document.getElementById('img3').src = 'images/pages/magnifying_glass.png';
}
else {
document.getElementById('img3').src = 'images/pages/pen.png';
document.getElementById("case").style.display='none';
}
}
</script>
<!--CONTENT-->
<div id="icons">
<li class="effect1"><img src="images/pages/financing.png" id="img" onclick="pic1()"alt="" width="150px" height="150px"><br>FINANCING<p id="text"></p></li>
<li class="effect2"><img src="images/pages/check.png" id="img2" onclick="pic2()" alt="" width="150px" height="150px"><br>FACTORS<p id="text2"></p></li>
<li class="effect3"><img src="images/pages/pen.png" id="img3" onclick="pic3()" alt="" width="150px" height="150px"><br>LEASING<p id="text3"></p></li>
</div> <!-- end icons -->
答案 0 :(得分:3)
看起来你的第一张图片有id&#34; img&#34;不是&#34; img1&#34;。