简体   繁体   English

如何通过Javascript获取链接的状态(悬停,活动,..)?

[英]How can I get state(hover,active,..) of link by Javascript?

Example I have a link with id = "demo" , now I want get a state of this link by javascript .示例我有一个id = "demo"的链接,现在我想通过javascript获取此链接的状态 I mean when the user mouses over this link, javascript can take state is hover .I try to research a lot but I don't see any functions to support this problem.我的意思是,当用户将鼠标悬停在此链接上时, javascript可以处于hover状态。我尝试进行了大量研究,但没有看到任何支持此问题的功能。 Can you give me some ideas.你能给我一些想法吗。 Thanks for all谢谢大家

I don't know exactly what you're trying, but javascript and css (hover state) do not speak with each other so you would need to manually get the state usign js events.我不确切知道您在尝试什么,但是 javascript 和 css (悬停状态)不会相互通信,因此您需要手动获取状态使用 js 事件。

I believe mouse over event could suit your problem.我相信鼠标悬停事件可能适合您的问题。 https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseover_event https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseover_event

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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