Sorry for the late reply. I was trying to use the first method to run the code. But somethings not working fine or it must be just that I am going wrong somewhere. Anyway with the help of your code I came up with something like this:
Code:
var a= new Array();
a[0]= "menu1";
a[1]= "menu2";
a[2]= "menu3";
a[3]= "menu4";
function change_it(itemID) {
document.getElementById(itemID).style.display='block';
var i= a.findindex(itemID);
b=a.slice(0,4);
b.splice(i,1);
document.getElementById(b).style.display='none';
}
It works fine for the first time but second time, when i click on the link it shows the portion of html and suddenly disappears. Could someone look at it and tell me where could the code be going wrong.
Thank you.