Home > Web Front-end > JS Tutorial > Solve a bug in setting the main entity in the hot zone through the fromElement attribute of the event object_javascript technique

Solve a bug in setting the main entity in the hot zone through the fromElement attribute of the event object_javascript technique

WBOY
Release: 2016-05-16 18:57:26
Original
1109 people have browsed it

After clicking the hyperlink "Set as main entity", the original prompt box will change color and display the content: "Already set as merged main entity".
Problem: When there is another hot zone b under the hyperlink on the prompt box of hot zone a, and click the hyperlink of the prompt box of hot zone a, the mouseover event of hot zone b will be triggered, causing hot zone a The prompt box will disappear.
I have been thinking about this problem for a long time but can’t find a solution. Last week Zhou Jun reminded me that I can detect the source element of the event. It suddenly occurred to me that IE's event object has an attribute fromElement, and I tested it. Sure enough, after clicking the hyperlink in the prompt box of hot zone a, the fromElement in the mouseover event of hot zone b was null, so it was easy to handle. When the hot zone was displayed In the function of the prompt box in the area, determine whether a fromElement is null, and return if it is null. This problem is solved, although this fromElement only exists in IE's event.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template