SoFunction
Updated on 2025-04-11

Solve a bug in setting the main entity in the hot zone through the fromElement property of the event object

Solve a bug in setting the main entity in the hot zone through the fromElement property of the event object

Updated: December 22, 2008 15:38:19 Author:
In the hot zone management in the background, if the mouse moves to the hot zone, a prompt box will be displayed, and hyperlinks such as "Set as main entity", "Delete" and "Merge" will be displayed. Clicking these hyperlinks can perform various operations.
After clicking the hyperlink "Set as main entity", the original prompt box will change color and the content will be displayed: "It has been set to merge main entity".
Question: When there is another hot zone b below the hyperlink on the prompt box in hot zone a, clicking the hyperlink on the prompt box in hot zone a will trigger the mouseover event in hot zone b, causing the prompt box in hot zone a to disappear.
I thought about this problem for a long time but couldn't find a solution. Last week, Zhou Jun reminded me that I could detect the source elements of the event. I suddenly thought that the event object of IE has a property fromElement. I tested it. Sure enough, after clicking the hyperlink of the prompt box of a hot zone, the fromElement in the mouseover event of the hot zone b hot zone is null. This is easy to do. In the function that displays the prompt box of the hot zone, determine whether a fromElement is null, and if it is null, return. The problem is solved at this point, although this fromElement only exists in the event of IE.
  • event
  • Object
  • fromElement

Related Articles

  • Detailed explanation of Javascript closures and example code

    This article mainly introduces the detailed explanation of Javascript closures and related information about the example code. Closures are a particularly abstract concept, especially the definition given by the ECMA specification. If you do not have practical experience, it is difficult to understand it from the definition. Friends who need it can refer to it.
    2016-11-11
  • Analysis of Ajv format verification usage example

    This article mainly introduces the example analysis of Ajv format verification use. Friends in need can refer to it for reference. I hope it can be helpful. I wish you more progress and get a promotion as soon as possible.
    2022-11-11
  • The js code I use for map conversion + reposting tool is very recommended

    [Red] The js code I use for the map conversion + reposting tool is very recommended...
    2007-04-04
  • 7 JavaScript Tips I Should Have Known

    This article explains several tips for writing js in detail, so that everyone can improve efficiency and learn to write code simplify
    2013-03-03
  • Detailed explanation of how to use gallery slider for WeChat mini program picture carousel component

    This article mainly introduces the use of the gallery slider, the WeChat mini program picture carousel component, which has certain reference value. Interested friends can refer to it.
    2018-01-01
  • Code examples of two implementation methods of JS countdown

    This article mainly introduces two implementation code examples of JS countdown. The example code is introduced in this article in detail, which has certain reference value for everyone's learning or work. Friends who need it can refer to it.
    2020-07-07
  • JavaScript Array - Array method summary (recommended)

    Below, the editor will bring you a summary of the JavaScript array-Array method (recommended). The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor
    2016-07-07
  • Analysis of JavaScript's method of implementing lazy image loading

    This article mainly introduces JavaScript to implement lazy image loading. It analyzes the principles, operation steps and related implementation techniques of JavaScript image lazy image loading based on examples. Friends who need it can refer to it.
    2018-07-07
  • Several concepts of javascript related events

    For events, first of all, we need to understand several concepts: event; event handler; event type; event flow; event bubble; event capture; event object; event performance optimization (event delegate, removal of event handler); common browser compatibility issues.
    2015-05-05
  • Common plug-ins and installation methods for Sublime Text 3

    This article mainly introduces relevant information about the commonly used plug-ins and installation methods of Sublime Text 3. Friends who need it can refer to it.
    2015-12-12

Latest Comments