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

geekjack geekjack at 163.com
Sun Aug 22 05:50:34 EDT 2010


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.



More information about the Users mailing list