<< Index

Style setter

Page | Source
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>   
    <title>XQIB: Sample page</title>
    <meta charset="UTF-8"/>
    <script type="text/javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
    <script type="application/xquery">
      declare sequential function local:listener($evt, $loc) {
        if(b:dom()//body/browser:getStyle(., "color") = "blue")
        then
          b:setStyle(b:dom()//body, "color", "red")
        else
          b:setStyle(b:dom()//body, "color", "blue")
      };

      b:addEventListener
        (b:dom()//input, "onclick", local:listener#2)
    </script>
  </head>
  <body style="color: red">
    <h1>Style setter</h1>
    This is text.
    <input type="button" value="Change text color!"/>
  </body>
</html>