。內容{顯示:?無;}& lt/style & gt;& lt/head & gt;& ltbody & gt& ltspan & gt設置為終點& ltdiv?class=\"content \" >1 & " />
& lthead & gt
& lttitle & gt& lt/title & gt;
& lt風格?type="text/css " >
。內容{顯示:?無;}
& lt/style & gt;
& lt/head & gt;
& ltbody & gt
& ltspan & gt設置為終點
& ltdiv?class="content " >1 & lt;/div & gt;
& ltdiv?class="content " >2 & lt/div & gt;
& ltdiv?class="content " >3 & lt/div & gt;
& lt腳本& gt
var?_ span = document . getelementsbytagname(" span ");
var?_ div = document . getelementsbytagname(" div ");
為了什麽?(var?我?=?0,len = _ span.length?我?& ltlen?i++)?{
_span[i]。index=_div[i]。index = I;
_span[i]。onclick=function(){
var?ind = this.index
如果?(_div[ind].className=="content ")?{
for(var?j = 0;j & ltlenj++){
_div[j]。className = " content
}
_div[ind]。className =
}否則{
_div[ind]。className = " content
}
}
};
& lt/script & gt;
& lt/body & gt;
& lt/html & gt;看看哪裏出了問題。