1: // README
2: //
3: // There are two steps to adding a property:
4: //
5: // 1. Create a member variable to store your property
6: // 2. Add the get_ and set_ accessors for your property
7: //
8: // Remember that both are case sensitive!
9:
10:
11: /// <reference name="MicrosoftAjaxTimer.debug.js" />
12: /// <reference name="MicrosoftAjaxWebForms.debug.js" />
13: /// <reference name="AjaxControlToolkit.ExtenderBase.BaseScripts.js" assembly="AjaxControlToolkit" />
14:
15:
16: Type.registerNamespace('AJAXControls.FormClear'); 17:
18: AJAXControls.FormClear.FormClearBehavior = function(element) { 19: AJAXControls.FormClear.FormClearBehavior.initializeBase(this, [element]);
20:
21: // TODO : (Step 1) Add your property variables here
22: }
23: AJAXControls.FormClear.FormClearBehavior.prototype = { 24: initialize: function() { 25: AJAXControls.FormClear.FormClearBehavior.callBaseMethod(this, 'initialize');
26:
27: // TODO: Add your initalization code here
28: Sys.UI.DomEvent.addHandler(this.get_element(), 'click',
29: Function.createDelegate(this, this._onclick));
30: },
31:
32: dispose: function() { 33: // TODO: Add your cleanup code here
34:
35: AJAXControls.FormClear.FormClearBehavior.callBaseMethod(this, 'dispose');
36: },
37:
38: _onclick: function() { 39: for (var x = 0; x < document.forms.length; ++x) { 40: var CurrentForm = document.forms[x];
41: var CurrentInputs = CurrentForm.getElementsByTagName('input'); 42: for (var y = 0; y < CurrentInputs.length; ++y) { 43: if (CurrentInputs[y].type == 'text' || CurrentInputs[y].type == 'password') { 44: CurrentInputs[y].value = '';
45: }
46: else if (CurrentInputs[y].type == 'checkbox') { 47: CurrentInputs[y].checked = false;
48: }
49: else if (CurrentInputs[y].type == 'radio') { 50: CurrentInputs[y].checked = false;
51: }
52: }
53: var CurrentSelects = CurrentForm.getElementsByTagName('select'); 54: for (var y = 0; y < CurrentSelects.length; ++y) { 55: CurrentSelects[y].options.selectedIndex = 0;
56: }
57: var CurrentTextAreas = CurrentForm.getElementsByTagName('textarea'); 58: for (var y = 0; y < CurrentTextAreas.length; ++y) { 59: CurrentTextAreas[y].value = '';
60: }
61: }
62: }
63: }
64: AJAXControls.FormClear.FormClearBehavior.registerClass('AJAXControls.FormClear.FormClearBehavior', AjaxControlToolkit.BehaviorBase);