try this solution(试试这个解决方案)
Just use(只需使用)
document.getElementById("defaultOpen").onmouseover();
instead of(代替)
document.getElementById("defaultOpen").mouseover();
function click_btn() { document.getElementById("defaultOpen").onmouseover(); } function openCompany(a, b) { alert('link'); }
<button class="tablinks" onclick="click_btn()" id="defaultOpenButton">London</button> <a class="tablinks" onmouseover="openCompany(event, 'xName')" id="defaultOpen">Link</a>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…