Changeset 117


Ignore:
Timestamp:
Oct 21, 2006, 11:06:16 PM (13 years ago)
Author:
David Sheldon
Message:

Fix for ticket:32. Use more of the yahoo utilities.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/static/tiles/mapTiles.js

    r108 r117  
    4545var spinnerElement;
    4646
     47function box1Keypress(e) {
     48  var event = YAHOO.util.Event.getEvent(e);
     49  var key = String.fromCharCode(YAHOO.util.Event.getCharCode(event));
     50  if (key == ' ') {
     51    document.getElementById('postcode2').focus();
     52    return false;
     53  } else if (key >= '0' && key <= '9' && this.value.length == 3) {
     54    this.value = this.value + key;
     55    document.getElementById('postcode2').focus();
     56    YAHOO.util.Event.preventDefault(event);
     57  }
     58}
     59
    4760function go() {
     61
     62  YAHOO.util.Event.addListener('postcode1', 'keypress', box1Keypress );
     63 
     64
    4865                mapElement.onclick = function(e) {
    4966                        e = YAHOO.util.Event.getEvent(e);
     
    90107                        }
    91108                }
    92                 document.getElementById('postcode1').onkeypress = function(e) {
    93                         var key = String.fromCharCode(window.event ? window.event.keyCode : e.which);
    94                         if (key == ' ') {
    95                                 document.getElementById('postcode2').focus();
    96                                 return false;
    97                         } else if (key >= '0' && key <= '9' && this.value.length == 3) {
    98                                 document.getElementById('postcode2').focus();
    99                         }
    100                 }
    101109        }
    102110       
Note: See TracChangeset for help on using the changeset viewer.