<< Index

Delete + Insert

Page | Source
<?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 updating function local:onclick($loc, $evtObj) {
        delete node b:dom()//input,
        insert node <hr color="red"/>
          as last into b:dom()//body
      };
      
      b:dom()//input
        /b:addEventListener
          (., "onclick", local:onclick#2)
    </script>
  </head>
  <body>
    <h1>Delete + Insert</h1>
    <input type="button" value="Click to replace me with a line!"/>
  </body>
</html>