我需要帮助为这些链接添加一个类:
<a class="campusIcon km-icon" onclick ="window.location.href='indexHome.html'" data-rel="external">Campus</a>
<a class="searchIcon km-icon" onclick ="window.location.href='indexListView.html'" data-rel="external">Search</a>
<a class="mapIcon km-icon" onclick ="window.location.href='indexKBlock.html'" data-rel="external">Map</a>
<a class="favIcon km-icon" onclick ="window.location.href='indexChart.html'" data-rel="external">Fav</a>
我要添加的类是km-state-active
. 如果我在onClick
事件中添加类,那么我会添加我的类但location.href
不起作用。
那么,有什么问题,我该如何解决呢?