Difference between revisions of "ARIA Live"

From Level Access Web Labs
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
This approach uses a change to inner HTML.  Activate the update result button to display a new value in the ARIA live region.
 +
 
<html>
 
<html>
 
<head>
 
<head>
Line 6: Line 8:
 
var result1 = 0;
 
var result1 = 0;
  
function update1() {
+
function update() {
 
result1 = result1 + 1;
 
result1 = result1 + 1;
 
document.getElementById("result1").innerHTML=result1;
 
document.getElementById("result1").innerHTML=result1;
 
}
 
}
 
function auto() {
 
function auto() {
   setTimeout(function(){update()},2000);
+
   setTimeout(function(){update()});
 +
  setTimeout(function(){auto()},2000);
 
}
 
}
 
</script>
 
</script>
Line 21: Line 24:
  
 
<div>
 
<div>
<button onclick="update1();">Update result</button>
+
<button onclick="update();">Update result</button>
 
<button onclick="auto();">Auto Update result</button>
 
<button onclick="auto();">Auto Update result</button>
 
</div>
 
</div>

Latest revision as of 01:53, 10 November 2018

This approach uses a change to inner HTML. Activate the update result button to display a new value in the ARIA live region.

... ...

...