Line | |
---|
1 | <?xml version="1.0" encoding="utf-8" ?>
|
---|
2 | <bindings xmlns="http://www.mozilla.org/xbl">
|
---|
3 | <binding id="numericfield">
|
---|
4 | <implementation>
|
---|
5 | <constructor>
|
---|
6 | this.keypress = CheckIsDigit ;
|
---|
7 | </constructor>
|
---|
8 | <method name="CheckIsDigit">
|
---|
9 | <body>
|
---|
10 | <![CDATA[
|
---|
11 | var iCode = keyCode ;
|
---|
12 |
|
---|
13 | var bAccepted =
|
---|
14 | (
|
---|
15 | ( iCode >= 48 && iCode <= 57 ) // Numbers
|
---|
16 | || (iCode >= 37 && iCode <= 40) // Arrows
|
---|
17 | || iCode == 8 // Backspace
|
---|
18 | || iCode == 46 // Delete
|
---|
19 | ) ;
|
---|
20 |
|
---|
21 | return bAccepted ;
|
---|
22 | ]]>
|
---|
23 | </body>
|
---|
24 | </method>
|
---|
25 | </implementation>
|
---|
26 | <events>
|
---|
27 | <event type="keypress" value="CheckIsDigit()" />
|
---|
28 | </events>
|
---|
29 | </binding>
|
---|
30 | </bindings>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.