my mapserver does not work in IE

Sandeep Bashyal gis at UNDPHAIS.ORG.NP
Fri Dec 10 01:39:50 EST 2004


On Thu, 9 Dec 2004 15:53:47 +0200, temiz <temiz at DEPREM.GOV.TR> wrote:

> hello
>
> For mapscript zoom function, this javascript code does not work in IE,
> but works in Linux browsers such as FireFox and Mozilla .
>
> Which part does not suit IE ?
>
> Here is the code ?
>
> ~~~~~~~~~~~~
> function startRubber (evt) {
>
>      if (document.all) {
>
>      var r = document.all.rubberBand;
>      r.style.width = 0;
>      r.style.height = 0;
>      r.style.pixelLeft = event.x;
>      r.style.pixelTop  = event.y;
>      r.style.visibility = 'visible';
>    }
>
>    else if (document.layers) {
>      var r = document.rubberBand;
>      r.clip.width = 0; r.clip.height = 0;
>      r.left = evt.x;
>      r.top = evt.y;
>      r.visibility = 'show';
>    }
>
>    else if (document.getElementById) {
>         var r = document.getElementById('rubberBand');
>      r.style.width = 0;
>      r.style.height = 0;
>      r.style.left = evt.clientX + 'px';
>      r.style.top = evt.clientY + 'px';
>      r.style.visibility = 'visible';
>    }
>
>    document.captureEvents(Event.MOUSEMOVE);
>    document.onmousemove = moveRubber;
> }
>
> function moveRubber (evt) {
>
>   if (document.all) {
>      var r = document.all.rubberBand;
>      r.style.width = event.x - r.style.pixelLeft - 2;
>      r.style.height = event.y - r.style.pixelTop - 2;
>      var f = document.forms('viewmap');
>      f.w.value = r.style.width;
>      f.h.value = r.style.height;
>    }
>
>    else if (document.layers) {
>      var r = document.rubberBand;
>      r.clip.width = evt.x - r.left - 2 ;
>      r.clip.height = evt.y - r.top - 2;
>      r.document.open();
>     r.document.write('<table width="'
>       + r.clip.width + '" height="' + r.clip.height
>       + '" BORDER="1"><tr><td><\/td><\/tr><\/table>');
>      r.document.close();
>      var f = document.forms('viewmap');
>      f.w.value = r.clip.width;
>      f.h.value = r.clip.height;
>    }
>
>   else if (document.getElementById) {
>      var r = document.getElementById('rubberBand');
>      r.style.width = evt.clientX - parseInt(r.style.left) - 2;
>      r.style.height = evt.clientY - parseInt(r.style.top) - 2;
>      var ht = document.getElementById('h');
>      var wt = document.getElementById('w');
>      wt.value = r.style.width;
>      ht.value = r.style.height;
>    }
>  }
>
> function stopRubber (evt) {
>       document.releaseEvents(Event.MOUSEMOVE);
>       document.onmousemove = null;
>
>  }

Ahmet,

These two lines apply only for netscape browsers:
>    document.captureEvents(Event.MOUSEMOVE);
>    document.releaseEvents(Event.MOUSEMOVE);
You should put them into an if(document.layers) condition.

--
Sandeep Bashyal
--
   National GIS Officer
   Humanitarian Assistance Information System (HAIS)
   United Nations (NEP/01/008)
   UN House, Pulchowk
   G.P.O. Box 107
   Kathmandu, Nepal
   Tel: (+977) 01 5543957
        (+977) 01 5554304
   Cell:(+977) 9841270854
   Fax: (+977) 01 5528059
--------------------------------------------------
mailto:gis at undphais.org.np
mailto:sandeep at earthmapping.com
http://www.undp.org.np



More information about the mapserver-users mailing list