我创建了一个表结构,其中每个 td 都有一个文本。调用 onclick 函数 changeFocus(liVSE) 不会返回 liVSE,同时提醒它,显示为 [object TableCellElement]。如果我需要将其提醒为 (liVSE),我该怎么办。或者请建议任何其他更简单的方法来获取 idname
请将我视为新手 HTML CSS Javascript 开发人员。
function changeFocus(idname){
alert(idname);
clearActive();
//"info-"+idname.style.display = "block";
idname.className = "tab-active";
return true;
}
<table>
<tbody>
<tr>
<td id="liVSE" class="tab-active" ><span class="tabcorner"><span></span></span><a href="#info-liVSE" onclick="changeFocus(liVSE)">li VSE</a></td>
<td id="liGoals" class="tab"><span class="tabcorner"><span></span></span><a href="#info-liGoals" onclick="changeFocus(liGoals)">li Goals</a></td>
<td id="CisoInitiatives" class="tab"><span class="tabcorner"><span></span></span><a href="#info-CisoInitiatives" onclick="changeFocus(CisoInitiatives)">li Iniatives</a></td>
<td id="EntBusCounsilVSE" class="tab"><span class="tabcorner"><span></span></span><a href="#info-EntBusCounsilVSE" onclick="changeFocus(EntBusCounsilVSE)">Ent. Bus. Council VSE</a></td>
<td id="DSSGVSE" class="tab"><span class="tabcorner"><span></span></span><a href="#info-DSSGVSE"onclick="changeFocus(DSSGVSE)"> VSE</a></td>
<td id="SSPGVSE" class="tab"><span class="tabcorner"><span></span></span><a href="#info-SSPGVSE" onclick="changeFocus(SSPGVSE)"> VSE</a></td>
<td id="SSPGGoals" class="tab"><span class="tabcorner"><span></span></span><a href="#info-SSPGGoals" onclick="changeFocus(SSPGGoals)"> Goals</a></td>
<td id="CPDMEffectivity" class="tab"><span class="tabcorner"><span></span></span><a href="#info-Effectivity" onclick="changeFocus(Effectivity)"> Effectivity</a></td>
</tr>
</tbody>
</table>