Arcgis 2.3 div cleared

Discussion created by giorginus80 on May 19, 2011
Latest reply on May 19, 2011 by giorginus80
Hi everybody,
I'm using a Arcgis V2.3 with a web application (ajax based) It works good, the only problem is that sometimes the ajax engine do a clear to the div (with the map inside) so How can I get back the map? I tried to store the innerHTML of the div, so when I detect the map is cleared i put it into again, and do a map.resize() and map.reposition again, but the result isn't good (as I imagined)
is there any other way?

I give an example:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples
      on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Create Map</title>
    <link rel="stylesheet" type="text/css" href="">
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">
   var map;
      function init() {
        map = new esri.Map("map");

        var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("");

      function clearMap(){
       var n = dojo.byId('map');
       n.innerHTML = '';

      function destroyMap(){

  <body class="claro">
    <div id="map" style="width:900px; height:600px; border:1px solid #000;"></div>
    <input type="button" value="CLEAR" onclick="clearMap();"/>
    <input type="button" value="DESTROY" onclick="destroyMap();"/>
    <input type="button" value="RECREATE" onclick="init();"/>

I create map, for some reason the div got cleared (click CLEAR to simulate) then if you click DESTROY calling map.destroy() (working for firefox but not for IE) I got an error, and I can't RECREATE the map.
How can I do?
Thanks in advance