<< Index
Change the background color
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="application/xquery">
declare sequential function local:set($loc, $evt) {
b:setStyle(b:dom()//body, "background-color", $loc/@value)
};
for $button in b:dom()//input[@type="button"]
return
b:addEventListener($button, "onclick", local:set#2)
</script>
</head>
<body>
<h1>Change the background color</h1>
<input type="button" value="Blue"/>
<input type="button" value="Red"/>
<input type="button" value="Green"/>
<br/>
<input type="button" value="Black"/>
<input type="button" value="White"/>
<input type="button" value="Yellow"/>
</body>
</html>