user3642438
user3642438

Reputation: 13

getElementById().disabled=true;

I am trying to disable two icons when one is clicked. Then all the icons are active once it is clicked again. I can't figure this out for the life of me. Any suggestions.I am trying to disable two icons when one is clicked. Then all the icons are active once it is clicked again. I can't figure this out for the life of me. Any suggestions.

<!--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 -->

Upvotes: 0

Views: 15681

Answers (1)

Ben Bartle
Ben Bartle

Reputation: 1080

It looks like your first image has id "img" not "img1".

Upvotes: 3

Related Questions