diff options
Diffstat (limited to 'framework/Web/Javascripts/base')
-rw-r--r-- | framework/Web/Javascripts/base/prado.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/base/prado.js b/framework/Web/Javascripts/base/prado.js index 81f51e41..b1e87634 100644 --- a/framework/Web/Javascripts/base/prado.js +++ b/framework/Web/Javascripts/base/prado.js @@ -1,3 +1,24 @@ Prado = Class.create();
Prado.version = '3.0a';
+
+Prado.DefaultButton = Class.create();
+
+Prado.DefaultButton.buttonFired = false;
+Prado.DefaultButton.fire = function(event, target)
+{
+ if (!Prado.DefaultButton.buttonFired && event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea")))
+ {
+ var defaultButton = document.getElementById ? document.getElementById(target) : document.all[target];
+ if (defaultButton && typeof(defaultButton.click) != "undefined")
+ {
+ Prado.DefaultButton.buttonFired = true;
+ defaultButton.click();
+ event.cancelBubble = true;
+ if (event.stopPropagation)
+ event.stopPropagation();
+ return false;
+ }
+ }
+ return true;
+}
|