diff lib/js/urweb.js @ 1785:ffd7ed3bc0b7

Basis.giveFocus
author Adam Chlipala <adam@chlipala.net>
date Sat, 21 Jul 2012 11:59:41 -0400
parents 5bc4fbf9c0fe
children d794149b3713
line wrap: on
line diff
--- a/lib/js/urweb.js	Sat Jul 21 10:12:35 2012 -0400
+++ b/lib/js/urweb.js	Sat Jul 21 11:59:41 2012 -0400
@@ -1824,5 +1824,14 @@
     return "uw" + (--nextId);
 }
 
+function giveFocus(id) {
+    var node = document.getElementById(id);
+
+    if (node)
+        node.focus();
+    else
+        er("Tried to give focus to ID not used in document: " + id);
+}
+
 
 // App-specific code