Материал из SamaraTrans.

Перейти к: навигация, поиск
Версия 12:26, 10 августа 2009 (править)
Buslov Anton (Обсуждение | вклад)

← К предыдущему изменению
Версия 12:29, 10 августа 2009 (править) (отменить)
Buslov Anton (Обсуждение | вклад)
(Содержимое страницы заменено на «<html> <head> <IFRAME src='http://samaratrans.info/testmp.html' width=100% height=700 scrolling='auto' frameborder=1>[Your user agent...»)
К следующему изменению →
Строка 1: Строка 1:
<html> <html>
<head> <head>
-<script src="http://api-maps.yandex.ru/1.0/?key=AHsKgEoBAAAAGVQ7NQIAq_90K97WC_SrhFNC7iiAoHDo1ZgAAAAAAAAAAAAI0aiXTNZ-tS3_oLyCm6OKpLUqEA==&ll=50.222095,53.262299&z=10&l=map&size=450,300&pt=37.700424,55.797149,pmywm1~37.891316, 55.804886,pmlbm~37.778712,55.842767,pmlbm~50.250931,53.233468,pmlbm&wizard=draw"  
- type="text/javascript"></script>  
- +<IFRAME src='http://samaratrans.info/testmp.html' width=100% height=700 scrolling='auto' frameborder=1>[Your user agent does not support frames or is currently configured not to display frames. However, you may visit <A href='http://samaratrans.info/testmp.html'>the related document.</A>]</IFRAME>
-<script type="text/javascript"> +
- function TextualZoomControl () {+
- this.element = document.createElement("DIV");+
- this.element.style.position = 'absolute';+
- this.element.style.zIndex = '1000';+
- }+
- +
- TextualZoomControl.prototype = {+
- onAddToMap: function (map, position) {+
- this.map = map;+
- this.position = position || new YMaps.ControlPosition(YMaps.ControlPosition.TOP_LEFT, new YMaps.Size(5, 30));+
- this._init();+
- },+
- +
- onRemoveFromMap: function () {+
- if (this.element.parentNode) {+
- this.map.getContainer().removeChild(this.element);+
- }+
- this.map = null;+
- },+
- +
- _init: function (map) {+
- var zoomInDiv = document.createElement("div"),+
- zoomOutDiv = document.createElement("div"),+
- _this = this;+
- +
- this._setButtonStyle(zoomInDiv);+
- this.element.appendChild(zoomInDiv);+
- zoomInDiv.appendChild(document.createTextNode("zoom in"));+
- +
- zoomInDiv.onclick = function () {+
- _this.map.setZoom(_this.map.getZoom() + 1);+
- };+
- +
- this._setButtonStyle(zoomOutDiv);+
- this.element.appendChild(zoomOutDiv);+
- zoomOutDiv.appendChild(document.createTextNode("zoom out"));+
- +
- zoomOutDiv.onclick = function () {+
- _this.map.setZoom(_this.map.getZoom() - 1);+
- };+
- +
- this.position.apply(this.element);+
- this.map.getContainer().appendChild(this.element);+
- },+
- +
- _setButtonStyle: function (button) {+
- style = {textDecoration: 'underline', +
- color: '#000000', +
- backgroundColor: 'white', +
- font: 'small Arial',+
- border: '1px solid green',+
- padding: '2px',+
- marginBottom: '3px',+
- textAlign: 'center',+
- width: '6em',+
- cursor: 'pointer'};+
- for (var k in style) {+
- button.style[k] = style[k];+
- }+
- }+
- }+
- +
- +
- +
- var map, geoResult;+
- +
- window.onload = function () {+
- map = new YMaps.Map(document.getElementById("YMapsID"));+
-// map.setCenter(new YMaps.GeoPoint(50.222095,53.262299), 10);+
- map.setCenter(new YMaps.GeoPoint(50.222095,53.262299), 11);+
- map.addControl(new YMaps.TypeControl());+
- map.addControl(new YMaps.Zoom());+
- map.enableHotKeys();+
- map.enableScrollZoom();+
- showAddress(document.getElementById('address').value);+
- }+
- +
- function showAddress (value) {+
- map.removeOverlay(geoResult);+
-// alert(value);+
- if (!value) value='Самара '+value;+
-// value={$address}{literal};+
- +
- +
- +
- var geocoder = new YMaps.Geocoder(value, {results: 1, boundedBy: map.getBounds()});+
- +
- YMaps.Events.observe(geocoder, geocoder.Events.Load, function () {+
- if (this.length()) {+
- geoResult = this.get(0);+
- map.addOverlay(geoResult);+
- map.setBounds(geoResult.getBounds());+
- }else {+
- alert("Ничего не найдено")+
- }+
- });+
-// address.value=value;+
- }+
- </script> +
-</head> 
-<body> 
-<center> 
- <div id="YMapsID" style="width:600px;height:400px"></div> 
- 
-<form action="#" onsubmit="showAddress( this.address.value );return false;"> 
- <p> 
- <input id="address" style="width:725px;" value="Самара" /> 
- <input type="submit" value="Искать" /> 
- </p> 
-  
- <div id="YMapsID" style="height:400px; width:800px;"></div> 
-</form> 
-</center> 
</body> </body>
</html> </html>

Версия 12:29, 10 августа 2009

Просмотры
Личные инструменты

© Авторский коллектив Самаратранс.info. 2005 - 2013. Для связи: astroaist [гав] gmail.com.
Все права защищены. Лицензионные правила Attribution-Noncommercial-Share Alike 3.0 Информация для СМИ.