chiark / gitweb /
Capture output in HTML
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 13 Sep 2025 22:12:58 +0000 (23:12 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 13 Jan 2026 21:42:18 +0000 (21:42 +0000)
webstead.xhtml

index 95fa47b7b38a6c1295d120d5952b8587ecefe242..52990e475b840026bb8828f7f8fcbc98899ed291 100644 (file)
@@ -2,13 +2,17 @@
   <head>
     <!-- SPDX-License-Identifier: CC0-1.0 -->
     <title>Bedstead editor test</title>
-    <script type="module">
+    <script type="module"><![CDATA[
       import Bedstead from './bedstead.js';
       document.getElementById("run").onclick = function(){
           Bedstead({
               arguments: document.getElementById("input").value.split(" "),
+              print: function(text) {
+                  document.getElementById("output").textContent = text;
+              }
           });
       };
+    ]]>
     </script>
   </head>
   <body>
@@ -17,5 +21,6 @@
       <input type="text" id="input"/>
       <input type="button" id="run" value="Run!"/>
     </form>
+    <p><code id="output"></code></p>
   </body>
 </html>