<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><title>Untitled Document</title><style>#div1. Active{background:Yellow;}#div1 Div{width:200px;Height:200px;background:#CCC;Border:1px solid #999;Display:None;}</style><Script>window.onload=function (){ varOdiv=document.getElementById ('Div1'); //get an element with ID Div1 varabtn=Odiv.getelementsbytagname ('input'); varAdiv=Odiv.getelementsbytagname ('Div'); for(varI=0; I<Abtn.length;i++) {Abtn[i].index=i; //the index value of the INPUT element is set to IAbtn[i].onclick=function () { for(varI=0; I<Abtn.length;i++) //empty the style of all input{abtn[i].classname="'; Adiv[i].style.display='None'; } This. ClassName='Active'; //Add the selected element class //alert (this.index);adiv[ This. Index].style.display='Block'; //displays the corresponding DIV element for the selection }; }};</Script></Head><Body><DivID= "Div1"> <inputclass= "Active"type= "button"value= "Education" /> <inputtype= "button"value= "Training" /> <inputtype= "button"value= "Admissions" /> <inputtype= "button"value= "Going Abroad" /> <Divstyle= "Display:block;">1111</Div> <Div>2222</Div> <Div>333</Div> <Div>4444</Div></Div></Body></HTML>
JS Tab 2