简体   繁体   中英

How to test for hovering over a link, and if so, get the element's href

I am working heavily with iframes, and would like to know if this is possible. Say there is an input with id search. If I hovered over a link (in an iframe) then is it possible to make it so the input would update via some event listener? I am okay with jQuery although I always prefer JS without any libraries.
If it isn't possible it's OK with me. Just wanted to know

Is this something you can do with onmouseover? https://www.w3schools.com/jsref/event_onmouseover.asp

<a href="click" onmouseover="hoverMe(this)">Click!</a>

<script>
function hoverMe(x) {
    console.log(x);
}

</script>

Then just open a document.write with the iframe to write the function hoverMe to all links.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM