Using JavaScript

JavaScript is an easy-to-use programming language that can be embedded in the header of web pages. It can enhance the dynamics and interactive features of custom pages by allowing you to perform calculations, check forms, include interactive games, add special effects, customize graphics selections, create security passwords and more.

JavaScript is provided by the HTML script tag, which can be used to embed JavaScript code directly into the page, or reference an external file that contains all of the JavaScript code. You can use script tags anywhere in the JSP page and they will be rendered in place.

JavaScript Libraries

The xMatters web application provides external scripts that include a variety of JavaScript libraries. Matt Kruse's JavaScript Toolbox provides the majority of these libraries (for details, visit http://www.javascripttoolbox.com).

Library URL Version
DHTML Calendar www.dynarch.com/projects/calendar 1.0
coolTip www.acooltip.com 1.71
Select Box Functions www.javascripttoolbox.com/lib/selectbox 04/20/2005
Option Transfer www.javascripttoolbox.com/lib/optiontransfer

07/12/2004

Date Functions www.javascripttoolbox.com/lib/date

1.02

Anchor Position www.mattkruse.com/javascript/anchorposition

10/11/2002

Popup Window www.javascripttoolbox.com/lib/popup

02/16/2004

Calendar Popup www.javascripttoolbox.com/lib/calendar 02/07/2005
Checkbox Group www.javascripttoolbox.com/lib/checkboxgroup 1.01
Dynamic Option List www.javascripttoolbox.com/lib/dynamicoptionlist 03/31/2004
Form Validations www.javascripttoolbox.com/lib/validations 12/29/2003

Custom JavaScript Library

You can create an external file that contains all of your JavaScript code. This is useful for several reasons: if there are common features that can be used across multiple JSP pages, keeping them in one location is recommended; and, if the JavaScript code is long and complicated, keeping it separate allows the JSP page to be more readable and easier to maintain.

This external file must be available in a relative location within the web application main directory structure. The web application is located in the xMatters installation directory, under webserver/webapp/cocoon/alarmpoint. You can create your own sub-directories under this location to store your own files. However, it is recommended that you create JavaScript files and directories under webserver/webapp/cocoon/alarmpoint/includes/javascript. For example:

webserver/webapp/cocoon/alarmpoint/includes/javascript/companyname/custom.js.
 

To reference your custom files, reference the directory structure relative to the main web application directory with a prefix of static. For example:

<script src="/static/includes/javascript/mycompany/custom.js" />

JavaScript Examples

Clearing the Working Cache