[OpenLayers-Users] How to refresh the div "map" only?

Imran Rajjad rajjad at gmail.com
Sun Aug 22 06:40:40 EDT 2010


well that depends that what do you call a refreshed map? when you will
call the init function it will obviously follow whats written in
function init(), if you firebug on mozilla firfox.. you can check the
map object for a possible reload funtion. or you might need to define
a different function.

regards,
Imran

On Sun, Aug 22, 2010 at 2:50 PM, geekjack <geekjack at 163.com> wrote:
>
> Hi all:
>   As the Openlayers make the maps show in the DIV "map" at my pages. Now I
> have a problem :
> If I want the <div id="map"> refreshed only in my page,when I click a
> button,what should I do to make it ? In my opinion : Ajax would be good to
> solve the problem,but I just cannot make it right because of my unfamiliar
> use of the Ajax.
> I have made it by the codes below:
>
> <script tpe="text/JavaScript">
>   function refdiv(){
>       document.getElementById("map").innerHTML = "";
>       init();
>   }
>
>   function init() {
>
>      ... //codes here
>
>           }
>
> </script>
>
> <body onload="init()">
>   ... //codes
>   <div id="map"><div>
>   <input type="button" onclick="refdiv();" value="test">
> </body>
>
> It is not a good method ,because when click the button "test",the map would
> be initialized,include the map center,the zoom-level...
> But I can save data:the center,the level and other options,and after
> clicking the button init the div,we can set the options base on the data
> saved.and make it looks "refreshed" not "initialized";
>
> But I still searching for a better method,can somebody help me? Thank you!!
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-refresh-the-div-map-only-tp5449343p5449343.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
I.R



More information about the Users mailing list