Javascript popupAlert - jcobban/Genealogy GitHub Wiki

function popupAlert(msg, element)

Up: Common Dialog Support

Source: /jscripts/util.js

This function replaces the standard Javascript alert function but uses the common dialog support popup mechanism to permit customizing the appearance and position of the alert message. The function has two parameters:

parameter description
msg string text to display in the popup
element an element on the page to use for positioning

The appearance of the alert is provided by <form id='Msg$template'> which is defined in all of the base page and dialog templates.

    <div class="balloon" id="msgDiv">
    </div>
    <div id="hideMsgTemplate" class="hidden">
      <!-- template for dialog reporting errors -->
      <form name="Msg\$template" id="Msg\$template">
	    <p class="message">\$msg</p>
    	<p>
	    <button type="button" id="closeDlg\$template">
    	    OK
	    </button>
	    </p>
      </form>
    </div>

Note that the dollar signs within the template are escaped so they are not removed by the template engine during PHP processing, since they are to be used by the Javascript function popupAlert. The overall appearance of all dialogs is set by the style div.balloon which sets the background-color, borders, margins, and so on for all dialogs.

Next: function popupHelp()

⚠️ **GitHub.com Fallback** ⚠️