diff options
author | xue <> | 2005-12-06 22:53:07 +0000 |
---|---|---|
committer | xue <> | 2005-12-06 22:53:07 +0000 |
commit | ec46fdc945f591e910051aca0457097825afd34c (patch) | |
tree | b79765ec299229678242267a7bfdf7e3c3f31349 /framework/Web/Javascripts/base/prado.js | |
parent | 03142d666493516ca86dede5380344f8c05b7633 (diff) |
Diffstat (limited to 'framework/Web/Javascripts/base/prado.js')
-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;
+}
|