Changeset 42


Ignore:
Timestamp:
Oct 15, 2006, 3:40:52 PM (13 years ago)
Author:
David Sheldon
Message:

Actualy send the data to the CGI (not sure about the location), pass in the coordinates to return to.

Improved location of the popup box for entering postcodes.

Location:
trunk/npemap.org.uk/static/tiles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/static/tiles/map.html

    r25 r42  
    4747  <div id="marker"></div>
    4848  <div id="postcode_form">
     49  <form method="post" action="../../cgi/submit.fcgi">
    4950    <div style="text-align: right;"><a href="javascript:closePostcodeWindow()" title="close">X</a></div>
    5051                <div><span id="location"></span></div>
    5152    <div><label for="postcode">Enter the postcode...</label></div>
    52     <div><input type="text" id="postcode" /></div>
     53    <input type="hidden" id="easting" name="easting" />
     54    <input type="hidden" id="northing" name="northing" />
     55    <input type="hidden" id="returnX" name="returnX" />
     56    <input type="hidden" id="returnY" name="returnY" />
     57    <div><input type="text" name="postcode" id="postcode" /></div>
    5358    <div><input type="submit" value="submit" /></div>
     59  </form>
    5460  </div>
    5561
  • trunk/npemap.org.uk/static/tiles/postcode.js

    r18 r42  
    1212      locationElement = document.getElementById('location');
    1313      mapElement.onclick = function(e) {
    14         var x = e.pageX - mapContainerElement.offsetLeft;
    15         var y = e.pageY - mapContainerElement.offsetTop;
     14        var x = e.pageX;
     15        var y = e.pageY;
    1616                                var img = e.target;
    1717                                var imgPos = YAHOO.util.Dom.getXY(img);
     
    2626                                var northing = baseNorthing + ('000' + Math.round((1-(tileY/img.offsetHeight))*1000)).substr(-3)
    2727
    28                                
    29         markerElement.style.left = (x-2) + 'px';
    30         markerElement.style.top = (y-2) + 'px';
     28                                YAHOO.util.Dom.setXY(markerElement, [(x-2), (y-2)]);
    3129        markerElement.style.visibility = 'visible';
    32         postcodeFormElement.style.left = (x-50) + 'px';
    33         postcodeFormElement.style.top = (y-180) + 'px';
     30       
     31        YAHOO.util.Dom.setXY(postcodeFormElement, [(x-50) < 0 ? 0:(x-50), (y-180) < 0 ? (y+10):(y-180)]);
    3432        postcodeFormElement.style.display = 'block';
    3533                                locationElement.innerHTML = easting + ', ' + northing
     34        document.getElementById('easting').value = easting;
     35        document.getElementById('northing').value = northing;
     36        document.getElementById('returnX').value = offsetGridX;
     37        document.getElementById('returnY').value = offsetGridY;
     38
     39        document.getElementById('postcode').value = "";
    3640        document.getElementById('postcode').focus();
    3741      }
Note: See TracChangeset for help on using the changeset viewer.