Материал из SamaraTrans.
| Версия 12:22, 10 августа 2009 (править) Buslov Anton (Обсуждение | вклад) ← К предыдущему изменению |
Текущая версия (21:27, 2 сентября 2009) (править) (отменить) Rootaria (Обсуждение | вклад) |
||
| (15 промежуточных версий не показаны.) | |||
| Строка 1: | Строка 1: | ||
| - | <html | + | <html> |
| <head> | <head> | ||
| - | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
| - | < | + | <IFRAME src='http://www.samaratrans.info/electr.php' width=100% height=1000px scrolling='auto' frameborder=0 name="iframe_electr">[Your user agent does not support frames or is currently configured not to display frames. However, you may visit <A href='http://www.samaratrans.info/electr.php'>the related document.</A>]</IFRAME> |
| - | + | ||
| - | |||
| - | function showAddress (value) { | ||
| - | // Удаляем все оверлеи | ||
| - | map.removeAllOverlays(); | ||
| - | // Запускаем процесс геокодирования | ||
| - | var geocoder = new YMaps.Geocoder(value, {results: 1, boundedBy: map.getBounds()}); | ||
| - | |||
| - | YMaps.Events.observe(geocoder, geocoder.Events.Load, function () { | ||
| - | //Если поиск прошел без ошибок и найден хотя бы один результат | ||
| - | if (this.length()) { | ||
| - | // Добавляем оверлей на карту | ||
| - | map.addOverlay(this.get(0)); | ||
| - | this.get(0).setBalloonContent(this.get(0).text); | ||
| - | // Открываем балун | ||
| - | this.get(0).openBalloon(); | ||
| - | }else { | ||
| - | alert("Ничего не найдено") | ||
| - | } | ||
| - | }); | ||
| - | |||
| - | // Если при геокодировании произошла ошибка, то сообщаем о ней | ||
| - | YMaps.Events.observe(geocoder, geocoder.Events.Fault, | ||
| - | function (error) {alert("Произошла ошибка: " + error.message)}); | ||
| - | } | ||
| - | </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> | ||
Текущая версия
