]> dev.renevier.net Git - syj.git/blobdiff - public/js/highlight.js
highlight for input on errors
[syj.git] / public / js / highlight.js
diff --git a/public/js/highlight.js b/public/js/highlight.js
new file mode 100644 (file)
index 0000000..289cd2a
--- /dev/null
@@ -0,0 +1,12 @@
+Element.addMethods({
+    highlight: function(element, color, timeout) {
+        var current;
+        if (typeof timeout === "undefined") {
+            timeout = 0.3;
+        }
+        current = element.getStyle('backgroundColor');
+        Element.setStyle(element, {'backgroundColor': color});
+        Element.setStyle.delay(timeout, element, {'backgroundColor': current});
+        return element;
+    }
+});