<div role="application">
<script type="text/javascript">
var messagesArray1 = new Array("0","1","2","3","4","5","6","7","8","9");
var live1 = new LiveRegion('liveregion1', 'timer1()', messagesArray1, 1000, 0, 'time1', 'live1', 'channel1', 'atomic1', 'relevant1');
function timer1 () { updateRegion( live1 ) };
widgets.add( live1 );
var messagesArray2 = new Array(
"The birch canoe slid on the smooth planks.",
"Glue the sheet to the dark blue background.",
"It's easy to tell the depth of a well.",
"These days a chicken leg is a rare dish.",
"Rice is often served in round bowls.",
"The juice of lemons makes fine punch.",
"The box was thrown beside the parked truck.",
"The hogs were fed chopped corn and garbage.",
"Four hours of steady work faced us.",
"Large size in stockings is hard to sell."
);
var live2 = new LiveRegion('liveregion2', 'timer2()', messagesArray2, 5000, 1, 'time2', 'live2', 'channel2', 'atomic2', 'relevant2');
function timer2 () { updateRegion( live2 ) };
widgets.add( live2 );
<script type="text/javascript">
/**
*
* The Globale Variables
*/
if (!window.Node) {
var Node = { // If there is no Node object, define one
ELEMENT_NODE: 1, // with the following properties and values.
ATTRIBUTE_NODE: 2, // Note that these are HTML node types only.
TEXT_NODE: 3, // For XML-specific nodes, you need to add
COMMENT_NODE: 8, // other constants here.
DOCUMENT_NODE: 9,
DOCUMENT_FRAGMENT_NODE: 11
}
}
var KEY_PAGEUP = 33;
var KEY_PAGEDOWN = 34;
var KEY_END = 35;
var KEY_HOME = 36;
var KEY_LEFT = 37;
var KEY_UP = 38;
var KEY_RIGHT = 39;
var KEY_DOWN = 40;
var KEY_SPACE = 32;
var KEY_TAB = 9;
var KEY_BACKSPACE = 8;
var KEY_DELETE = 46;
var KEY_ENTER = 13;
var KEY_INSERT = 45;
var KEY_ESCAPE = 27;
var KEY_F1 = 112;
var KEY_F2 = 113;
var KEY_F3 = 114;
var KEY_F4 = 115;
var KEY_F5 = 116;
var KEY_F6 = 117;
var KEY_F7 = 118;
var KEY_F8 = 119;
var KEY_F9 = 120;
var KEY_F10 = 121;
var KEY_M = 77;
var NS_XHTML = "http://www.w3.org/1999/xhtml"
var NS_STATE = "http://www.w3.org/2005/07/aaa";
/**
*
* previousSiblingElement
*
* @param ( node ) node object for which you are looking for the next sibling element node
*
* @return ( node) next sibling or "null"
*/
/**
*
* firstChildElement
*
* @param ( node ) node object for which you are looking for the first child element node
*
* @return ( node) next sibling or "null"
*/
<script type="text/javascript">
// JavaScript Document
// Widgets is a way to initialize widgets in the ARIA examples
function Widgets() {
this.widgets = new Array();
}
/**
* add is member of the Widgets Object
* and used add a widget ot the list of widgets to be intitialized
* as part of the onload event
* The controls array is the list of controls to initialize
* @member Enable
* @return none
*/
/**
* init is member of the Widgets Object
* and is called by the onload event to initialize widgets in the web resource
* The controls array is the list of controls to initialize
* @member Enable
* @return none
*/
Widgets.prototype.init = function() {
for(var i = 0; i < this.widgets.length; i++ )
this.widgets[i].init();
}
<script type="text/javascript">
// JavaScript Document
// This module is to abstract browser dependencies
// This makes the widget code cleaner and earier to read by making most browser specfic coding
// in one place rather han scatered throghot documents
var ARIA_STATE = "aria-";
//
// WebBrowser object to abstract accessibility API differences between web standards supporting browsers and Internet Explorer 7.0
//
// The state variable keeps track of current state of checkbox
function WebBrowser() {
}
//
// keyCode is a function to get the keycode from a keypress event
//
// @param ( event object) event is an event object
//
// @return ( keycode )
WebBrowser.prototype.keyCode = function( event ) {
var e = event || window.event;
// If a web standards based browser implement this function
WebBrowser.prototype.simulateOnClickEvent = function( node ) {
// W3C DOM Events way to trigger a "click" event
var e = document.createEvent('MouseEvents');
e.initEvent( 'click', true, true );
node.dispatchEvent( e );
}
} else {
// If a Microsoft IE based browser implement this function
// For browsers that do not support W3C or IE event functions
WebBrowser.prototype.addEvent = function(elmTarget, sEventName, fCallback) {
return false;
};
<script type="text/javascript">
/**
*
* The LiveRegion object is used to maintain information about a live region
* @contructor
* @param ( id ) id of element that is a live region
* @param ( messages ) an array of messages to update the live region
* @return nothing
*/
function LiveRegion ( id , func, messages, time, add, time_id, live_id, channel_id, atomic_id, relevant_id ) {
//
// update properties
liveRegionSetTimer( this );
liveRegionSetLive( this );
liveRegionSetChannel( this );
liveRegionSetAtomic( this );
liveRegionSetRelevant( this );
}
/**
*
* The setLive updates the live attribute
* @param ( id ) id of the select control with the new timer value
*
* @return nothing
*/
function liveRegionSetTimer( live_region ) {
// get control with new interval value
control = document.getElementById(live_region.time_id);
// get new interval value from select control
new_interval = control.options[control.selectedIndex].text;
// convert number to miiliseconds
live_region.interval = new_interval * 1000;
// stop current timer
clearInterval( live_region.intervalID );
// restart imter with new timer value
live_region.intervalID = setInterval( live_region.func, live_region.interval );
}
/**
*
* The setLive updates the live attribute
* @param ( id ) id of the select control with the new live region value
* @return nothing
*/
function liveRegionSetLive( live_region ) {
control = document.getElementById(live_region.live_id);
/**
*
* The updateRegion updates the live region with new content basedon messageArray from a timer event
* @param ( live_region ) LiveRegion obj
* @return nothing
*/
function updateRegion ( live_region ) {
if( live_region.add > 0 ) {
// If add=1 then add content
text = live_region.messages[live_region.index++];