The `DEP_UI.debug' function writes a trace message to the `trace'
element, if there is one. Add a `trace' element.
/*----- Utility functions and classes -------------------------------------*/
+DEP_UI.debug = function(msg) {
+ /* Write the string MSG to the `trace' element, if there is one. */
+
+ var e = elt('trace');
+ if (e !== null) e.textContent += msg;
+}
+
+ DEP_UI.trap = function(what, func) {
+ try {
+ func();
+ } catch (e) {
+ debug('caught exception in ' + what + ': ' + e);
+ throw e;
+ }
+}
+
DEP_UI.elt = function (id) {
/* Find and return the element with the given ID. */
return document.getElementById(id);
<h1>Rolling wire-strip calculator</h1>
+<div id=trace style="white-space: pre"></div>
<script type="text/javascript"><!--
--></script>