I am coming back to a website and have a bit of time to tidy things up, and wondered with the script below, as I do have a few of these chunks, if there a way to use less lines, as every line is unique in that the id’s are different but only one’s css value is different, so wondered if I could only use 2 document.getElementById lines, putting all the same id’s in one line with ‘none’ as the css value, leaving the other line to be on its own with the value of ‘block’
function subShowHidec(obj){
for(i=1;i<=7;i++){
if (i == obj) {
document.getElementById('qqb'+i).style.display = 'none';
document.getElementById('qq'+i).style.display = 'none';
document.getElementById('qqc'+i).style.display = 'block';
document.getElementById('qqd'+i).style.display = 'none';
document.getElementById('qqe'+i).style.display = 'none';
document.getElementById('qqf'+i).style.display = 'none';
document.getElementById('qqg'+i).style.display = 'none';
} else {
document.getElementById('qqc'+i).style.display = 'none';
}
}
return false;
}
I am also now developing in Visual Studio and the code block below is having problems. Basically on load the image loads fine, but when I roll-over it the image disappears, when a new image should show instead.
<div class="col span_1_of_4">
<a href="#" onClick="showHide(3);" id="map3">
<img src="~/Images/Contact/MiddleEast-Africa/Off/Middle_East_&_Africa_Grey.png" onMouseOver="this.src='~/Images/Contact/MiddleEast-Africa/On/Middle_East_&_Africa.png'" onMouseOut="this.src='~/Images/Contact/MiddleEast-Africa/Off/Middle_East_&_Africa_Grey.png'" alt="" />
</a>
</div>