I'm making a website where I have a navbar on top, and when I hover my mouse over 1 of the nav-items, a sub-nav drops down, but now I have a javascript / ajax function on my nav-item when I click the nav-item, it shows another html page in my subnav, like this:
<a href="javascript:ajaxpage('home_nav.html',%20'subnav');">Home</a>
Is it possible to get the function in the 'href' part also work when I only hover the link? So when I hover a nav-item, the sub-nav with the included html subnav drops down.
In html5 you can attach another javascript to mouseover event:
<a href="javascript:ajaxpage('home_nav.html',%20'subnav');" onmouseover="ajaxpage('home_nav.html',%20'subnav');">Home</a>
Note: remove javascript word now, because this argument itself is a javascript function. You add only javascript to events, basically. href is different, it is an address in normal case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.