AW: [OpenLayers-Users] Javascript - Functioncall: strange behaviour

Budschedl Harald Harald.Budschedl at ikt.linz.at
Wed Jun 1 01:59:51 EDT 2011


That did the trick! Awsome!

Thanks alot!!

Harry

________________________________
Von: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Marc Jansen
Gesendet: Dienstag, 31. Mai 2011 22:18
An: openlayers-users at lists.osgeo.org
Betreff: Re: [OpenLayers-Users] Javascript - Functioncall: strange behaviour

Hi Harry,

just guessing, but does IE show anything when you set the options-value as well as its text? Try to add

sbox.options[x].value=streetlist.features[x].properties.Adresse;

after

sbox.options[x].text=streetlist.features[x].properties.Adresse;

As I said, this just a guess.

Regards,
Marc


Am 31.05.2011 13:12, schrieb Budschedl Harald:
Hi folks

I have a not strictly OL related problem concerning a function call which works in FF, Safari, Opera, etc ... but does not work in IE (7 and 8)

Let me tell you what I try to do.

1st step:
An ajax control fills a selectbox with adresses. The webservice delivers geoJSON btw. The serializing of the JSON-Object (streetlist) and the filling of the selectbox (sbox) looks like this:
-------->
                                                                streetlist = eval('(' + httpRequest.responseText + ')');
                                                                //alert(streetlist);
                                                                sbox = document.getElementById('straSel');
                                                                sbox.length=streetlist.features.length-1;
                                                                if (sbox.length<=0) {sbox.length=1}
                                                                for(x=0; x< streetlist.features.length-1; x++){
                                                                        sbox.options[x].text=streetlist.features[x].properties.Adresse;
                                                                }
<----------
Everything works out fine. The Ajax works, the Selectbox is filled, all of this works fine in all the browsers.
So now we have a Selectbox, filled with Adresses.

2nd step:
>From my selectbox, I select one entry and klick on the "get me there"-button to call a function "goThere" which will find the appropriate X and Y coords from the geoJSON Object and zoom the map to there.
The Selectbox and "get me there" Butto look like this:
---------->
                <p>
                        <select id="straSel" name="straSel" size="5" >
                                <option id="straOpt">Click result ...</option>
                         </select>
                </p>
                <input type="button" value="get me there" onclick="goThere();" />
<----------
The function looks like this:
------------>
                        function goThere() {
                                // gets XY coordinates for selected entry and zooms there
                                var adressX;
                                var adressY;

                                var selbox =document.getElementById('straSel');
                                var selIndx=selbox.selectedIndex;
                                selectedAdr=selbox.options[selIndx].value;
                                //alert(selbox.options[selbox.selectedIndex].value);
                                alert(" At index"+selIndx+" in the box, there is "+selectedAdr);
                                if (streetlist) {
                                        for(x=0; x< streetlist.features.length-1; x++){
                                                if (streetlist.features[x].properties.Adresse == selectedAdr) {
                                                        adressX=streetlist.features[x].geometry.coordinates[0];
                                                        adressY=streetlist.features[x].geometry.coordinates[1];
                                                        //alert(selectedAdr + '___X=' + adressX + '___Y=' + adressY);
                                                        map.setCenter(new OpenLayers.LonLat(adressX,adressY),allScales[1],false,true);
                                                        break;
                                                }
                                        }
                                }
                        }
<------------

I also tried to deliver the Adress itself in the function call, but this doesn't change anything.

The function works fine in Firefox
It works fine in Safari
It works fine in Opera.
Heck, it even works fine on my Palm Pre Plus...

Just IE (7 and 8) does not do ANYTHING. I found out (using the alert statements) that the value is always empty in IE.

Has anyone an idea what's the problem?

TIA!!
Harry

IKT Linz GmbH
Ein Unternehmen der Stadt Linz

4040 Linz, Hauptstraße 1-5
AUSTRIA



  ________________________________
Diese Nachricht inklusive aller Anhänge kann vertrauliche Informationen enthalten. Sie ist ausschließlich für die adressierten Personen bestimmt. Das unerlaubte Kopieren sowie die unbefugte Weitergabe sind nicht gestattet. Sollten Sie nicht die richtige Adressatin/der richtige Adressat sein, vernichten Sie den gesamten Inhalt (§ 93 Abs. 4 Telekommunikationsgesetz 2003) und informieren Sie bitte sofort den/die Absender/in. Nähere Regelungen zur elektronischen Kommunikation mit der Stadt Linz finden Sie in den "Allgemeinen Hinweisen und Nutzungsbestimmungen betreffend das E-Government der Stadt Linz (e-linz)" ( http://www.linz.at/images/AGB_egov_2008.pdf )

IKT Linz GmbH, Firmenbuch des Landesgerichtes Linz ++ Firmenbuch-Nummer: 321197z ++ UID-Nummer: ATU64636344
IKT Linz Infrastruktur GmbH, Firmenbuch des Landesgerichtes Linz ++ Firmenbuch-Nummer: 321990s ++ UID-Nummer: ATU64664303
A-4020 Linz, Gruberstraße 42, Tel. +43 732 7070 0, Fax: +43 732 7070 54 1555, office at ikt.linz.at<mailto:office at ikt.linz.at>, www.linz.at/ikt<http://www.linz.at/ikt>


_______________________________________________
Users mailing list
Users at lists.osgeo.org<mailto:Users at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/openlayers-users



________________________________
Diese Nachricht inklusive aller Anhänge kann vertrauliche Informationen enthalten. Sie ist ausschließlich für die adressierten Personen bestimmt. Das unerlaubte Kopieren sowie die unbefugte Weitergabe sind nicht gestattet. Sollten Sie nicht die richtige Adressatin/der richtige Adressat sein, vernichten Sie den gesamten Inhalt (§ 93 Abs. 4 Telekommunikationsgesetz 2003) und informieren Sie bitte sofort den/die Absender/in. Nähere Regelungen zur elektronischen Kommunikation mit der Stadt Linz finden Sie in den "Allgemeinen Hinweisen und Nutzungsbestimmungen betreffend das E-Government der Stadt Linz (e-linz)" ( http://www.linz.at/images/AGB_egov_2008.pdf )

IKT Linz GmbH, Firmenbuch des Landesgerichtes Linz ++ Firmenbuch-Nummer: 321197z ++ UID-Nummer: ATU64636344
IKT Linz Infrastruktur GmbH, Firmenbuch des Landesgerichtes Linz ++ Firmenbuch-Nummer: 321990s ++ UID-Nummer: ATU64664303
A-4020 Linz, Gruberstraße 42, Tel. +43 732 7070 0, Fax: +43 732 7070 54 1555, office at ikt.linz.at, www.linz.at/ikt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110601/909de5d0/attachment-0001.html


More information about the Users mailing list