Javascript actMouseOverHelp - jcobban/Genealogy GitHub Wiki

function actMouseOverHelp(divName)

Up: Common Dialog Support

Source: /jscripts/util.js

This global function is called on a document element to activate support for popup help.

parameter contents
this the element for which popup help is to be activated
divName optionally specify the id attribute value of the division which is to be displayed.

If this identifies a <textarea> tag then support for popup help is activated on its parent element because TinyMCE disables the <textarea> to replace it with its rich-text editor.

If divName is not passed as a parameter then the default division id value is determined as follows:

  1. If the element has an attribute for=, then it is a <label> tag and the value of the for= is used to construct the default division id by pre-pending 'Help'.
  2. If the element has an attribute name=, then it is an old-style input element and the value of the name= is used to construct the default division id by pre-pending 'Help'.
  3. If the element has an attribute id=, then it is a current-style input element and the value of the id= is used to construct the default division id by pre-pending 'Help'.
  4. Otherwise the function is unable to activate popup help support. The problem is logged along with the contents of the invalid element and the function returns false.

The function returns true if it was able to identify the name of the help division and activated support, and false if it could not.

This function logs an error message if the required help division is not defined in the current page. This means that the developer will be informed when the page is first displayed of the missing division.

For example:

    let form           = document.forms[0];
    let message        = form.message;
    actMouseOverHelp.call(message, 'Helpmessage');

The following code is run on every page to initialize popup help support for every input element in every form.

    for(let i = 0; i < document.forms.length; i++)
    {           // iterate through all forms
        let form    = document.forms[i];
        for(let j = 0; j < form.elements.length; j++)
        {       // loop through elements in form
            actMouseOverHelp.call(form.elements[j]);
        }       // loop through elements in form
    }           // iterate through all forms

Next: function addHelpAbbrs(helpDiv, abbrTable)