Auteur Topic: [php][js] Javascript werkt niet goed....  (gelezen 1034 keer)

0 leden en 1 gast bekijken dit topic.

xvilo

  • Global Moderator
  • Verslaafd DigitalPlace Lid
  • *****
  • Berichten: 2675
  • Karma: -44
    • Bekijk profiel
    • http://www.xvilo.com
[php][js] Javascript werkt niet goed....
« Gepost op: maart 22, 2013, 09:58:57 am »
  • [+1]0
  • [-1]0
  • Hallo [you],

    Voor school hebben we een project over wellwater.... Nu moeten we hier een website voor maken, alleen heb ik een probleem met een javascriptje van de Google Maps API!

    Ik wil eigenlijk het zelfde Javascript bestandje gebruiken, voor een kleine map (zie de homepage) en een grote fullscreen map (zie de fullscreen pagina).

    Nu heb ik dus het javascriptje gekopieerd van de originele wellwater site, en dat werkte naar behoren. Maar op de homepage staat de zoom op 2, dit is voor daar groot genoeg, alleen voor de fullscreen page is dat TE GROOT! Dus ik dacht, laten we daar de zoom op 4 zetten. Nu kan ik dus niet [icode:26oxzp7h]maps.js?zoom=4[/icode:26oxzp7h] doen, dus heb ik een php scriptje gemaakt die PRECIES het zelfde laat zien maar dan de zoom veranderd. Dan krijgen we dus het probleem. Het mapje werkt niet meer.......... Heeeeeel raar..... ik weet niet wat er fout is.

    Dit is het javascriptje:
    function initialize() {
    var mapOptions = {
    zoom: 2,
    center: new google.maps.LatLng(15, 45),
    panControl: true,
    zoomControl: true,
    mapTypeControl: false,
    scaleControl: false,
    streetViewControl: false,
    overviewMapControl: false,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var open = null;

    var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);



    var marker1 = new google.maps.Marker({
    position: new google.maps.LatLng(-15.7861,35.0058),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow1 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/24-123-thumb.jpg" alt="Malawi, 2012, Blantyre"><br><a href="/projecten/malawi-2012-blantyre"><strong>Malawi, 2012, Blantyre</strong></a>'
    });

    google.maps.event.addListener(marker1, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow1.open(map, marker1);

    open = infoWindow1;
    });



    var marker2 = new google.maps.Marker({
    position: new google.maps.LatLng(-14.8119,24.7974),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow2 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/23-112-thumb.jpg" alt="Zambia 2011, Kaoma-en Mongu-districten"><br><a href="/projecten/zambia-2011-kaoma-en-mongu-districten"><strong>Zambia 2011, Kaoma-en Mongu-districten</strong></a>'
    });

    google.maps.event.addListener(marker2, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow2.open(map, marker2);

    open = infoWindow2;
    });



    var marker3 = new google.maps.Marker({
    position: new google.maps.LatLng(-0.154284,37.3175),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow3 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/22-104-thumb.jpg" alt="Kenia, 2010, Murhanda"><br><a href="/projecten/kenia-2010-murhanda"><strong>Kenia, 2010, Murhanda</strong></a>'
    });

    google.maps.event.addListener(marker3, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow3.open(map, marker3);

    open = infoWindow3;
    });



    var marker4 = new google.maps.Marker({
    position: new google.maps.LatLng(0.314269,32.5729),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow4 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/14-89-thumb.jpg" alt="Oeganda, 2009, Kampala"><br><a href="/projecten/oeganda-2009-kampala"><strong>Oeganda, 2009, Kampala</strong></a>'
    });

    google.maps.event.addListener(marker4, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow4.open(map, marker4);

    open = infoWindow4;
    });



    var marker5 = new google.maps.Marker({
    position: new google.maps.LatLng(27.6264,83.3789),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow5 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/15-88-thumb.jpg" alt="Nepal, 2009, Rupendehi"><br><a href="/projecten/nepal-2009-rupendehi"><strong>Nepal, 2009, Rupendehi</strong></a>'
    });

    google.maps.event.addListener(marker5, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow5.open(map, marker5);

    open = infoWindow5;
    });



    var marker6 = new google.maps.Marker({
    position: new google.maps.LatLng(5.55572,-0.196306),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow6 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/21-94-thumb.jpg" alt="Relatiereis Simavi-Well Water 16-21 september 2009"><br><a href="/projecten/relatiereis-simavi-well-water-16-21-september-2009"><strong>Relatiereis Simavi-Well Water 16-21 september 2009</strong></a>'
    });

    google.maps.event.addListener(marker6, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow6.open(map, marker6);

    open = infoWindow6;
    });



    var marker7 = new google.maps.Marker({
    position: new google.maps.LatLng(22.9868,87.855),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow7 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/13-47-thumb.jpg" alt="India, 2008, West Bengalen, Sundurban regio"><br><a href="/projecten/india-2008-west-bengalen-sundurban-regio"><strong>India, 2008, West Bengalen, Sundurban regio</strong></a>'
    });

    google.maps.event.addListener(marker7, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow7.open(map, marker7);

    open = infoWindow7;
    });



    var marker8 = new google.maps.Marker({
    position: new google.maps.LatLng(22.7033,90.3745),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow8 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/6-70-thumb.jpg" alt="Bangladesh, Barisal, 2007"><br><a href="/projecten/bangladesh-barisal-2007"><strong>Bangladesh, Barisal, 2007</strong></a>'
    });

    google.maps.event.addListener(marker8, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow8.open(map, marker8);

    open = infoWindow8;
    });



    var marker9 = new google.maps.Marker({
    position: new google.maps.LatLng(4.30199,97.2625),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow9 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/11-61-thumb.jpg" alt="Indonesië, 2006, Dusun Kalinanas"><br><a href="/projecten/indonesi-2006-dusun-kalinanas"><strong>Indonesië, 2006, Dusun Kalinanas</strong></a>'
    });

    google.maps.event.addListener(marker9, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow9.open(map, marker9);

    open = infoWindow9;
    });



    var marker10 = new google.maps.Marker({
    position: new google.maps.LatLng(0.338581,32.5447),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow10 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/10-59-thumb.jpg" alt="Oeganda, 2005, Parish"><br><a href="/projecten/oeganda-2005-parish"><strong>Oeganda, 2005, Parish</strong></a>'
    });

    google.maps.event.addListener(marker10, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow10.open(map, marker10);

    open = infoWindow10;
    });



    var marker11 = new google.maps.Marker({
    position: new google.maps.LatLng(0.3,30.6),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow11 = new google.maps.InfoWindow({
    content: '<img src="http://www.wellwater.nl/images/projecten/9-54-thumb.jpg" alt="Oeganda, 2004, Bisozi"><br><a href="/projecten/oeganda-2004-bisozi"><strong>Oeganda, 2004, Bisozi</strong></a>'
    });

    google.maps.event.addListener(marker11, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow11.open(map, marker11);

    open = infoWindow11;
    });

    //begin van ding
    var marker12 = new google.maps.Marker({
    position: new google.maps.LatLng(52.129563,-3.777881),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow12 = new google.maps.InfoWindow({
    content: '<br><a href="#"><strong>Hier word het water opgepompt</strong></a>'
    });

    google.maps.event.addListener(marker12, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow1.open(map, marker12);

    open = infoWindow12;
    });
    //end van ding

    }
    is hier te vinden: (http://school.infiniocorp.com/wellwater ... s/maps2.js)

    en dit is de code van mijn php scriptje:
    <?php
    Header("content-type: application/x-javascript");
    $zoom = $_GET["zoom"];

    echo "function initialize() {
    var mapOptions = {
    zoom: " . $zoom .",
    center: new google.maps.LatLng(15, 45),
    panControl: true,
    zoomControl: true,
    mapTypeControl: false,
    scaleControl: false,
    streetViewControl: false,
    overviewMapControl: false,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var open = null;

    var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);



    var marker1 = new google.maps.Marker({
    position: new google.maps.LatLng(-15.7861,35.0058),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow1 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/24-123-thumb.jpg' alt='Malawi, 2012, Blantyre'><br><a href='/projecten/malawi-2012-blantyre'><strong>Malawi, 2012, Blantyre</strong></a>'
    });

    google.maps.event.addListener(marker1, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow1.open(map, marker1);

    open = infoWindow1;
    });



    var marker2 = new google.maps.Marker({
    position: new google.maps.LatLng(-14.8119,24.7974),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow2 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/23-112-thumb.jpg' alt='Zambia 2011, Kaoma-en Mongu-districten'><br><a href='/projecten/zambia-2011-kaoma-en-mongu-districten'><strong>Zambia 2011, Kaoma-en Mongu-districten</strong></a>'
    });

    google.maps.event.addListener(marker2, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow2.open(map, marker2);

    open = infoWindow2;
    });



    var marker3 = new google.maps.Marker({
    position: new google.maps.LatLng(-0.154284,37.3175),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow3 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/22-104-thumb.jpg' alt='Kenia, 2010, Murhanda'><br><a href='/projecten/kenia-2010-murhanda'><strong>Kenia, 2010, Murhanda</strong></a>'
    });

    google.maps.event.addListener(marker3, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow3.open(map, marker3);

    open = infoWindow3;
    });



    var marker4 = new google.maps.Marker({
    position: new google.maps.LatLng(0.314269,32.5729),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow4 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/14-89-thumb.jpg' alt='Oeganda, 2009, Kampala'><br><a href='/projecten/oeganda-2009-kampala'><strong>Oeganda, 2009, Kampala</strong></a>'
    });

    google.maps.event.addListener(marker4, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow4.open(map, marker4);

    open = infoWindow4;
    });



    var marker5 = new google.maps.Marker({
    position: new google.maps.LatLng(27.6264,83.3789),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow5 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/15-88-thumb.jpg' alt='Nepal, 2009, Rupendehi'><br><a href='/projecten/nepal-2009-rupendehi'><strong>Nepal, 2009, Rupendehi</strong></a>'
    });

    google.maps.event.addListener(marker5, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow5.open(map, marker5);

    open = infoWindow5;
    });



    var marker6 = new google.maps.Marker({
    position: new google.maps.LatLng(5.55572,-0.196306),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow6 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/21-94-thumb.jpg' alt='Relatiereis Simavi-Well Water 16-21 september 2009'><br><a href='/projecten/relatiereis-simavi-well-water-16-21-september-2009'><strong>Relatiereis Simavi-Well Water 16-21 september 2009</strong></a>'
    });

    google.maps.event.addListener(marker6, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow6.open(map, marker6);

    open = infoWindow6;
    });



    var marker7 = new google.maps.Marker({
    position: new google.maps.LatLng(22.9868,87.855),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow7 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/13-47-thumb.jpg' alt='India, 2008, West Bengalen, Sundurban regio'><br><a href='/projecten/india-2008-west-bengalen-sundurban-regio'><strong>India, 2008, West Bengalen, Sundurban regio</strong></a>'
    });

    google.maps.event.addListener(marker7, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow7.open(map, marker7);

    open = infoWindow7;
    });



    var marker8 = new google.maps.Marker({
    position: new google.maps.LatLng(22.7033,90.3745),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow8 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/6-70-thumb.jpg' alt='Bangladesh, Barisal, 2007'><br><a href='/projecten/bangladesh-barisal-2007'><strong>Bangladesh, Barisal, 2007</strong></a>'
    });

    google.maps.event.addListener(marker8, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow8.open(map, marker8);

    open = infoWindow8;
    });



    var marker9 = new google.maps.Marker({
    position: new google.maps.LatLng(4.30199,97.2625),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow9 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/11-61-thumb.jpg' alt='Indonesië, 2006, Dusun Kalinanas'><br><a href='/projecten/indonesi-2006-dusun-kalinanas'><strong>Indonesië, 2006, Dusun Kalinanas</strong></a>'
    });

    google.maps.event.addListener(marker9, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow9.open(map, marker9);

    open = infoWindow9;
    });



    var marker10 = new google.maps.Marker({
    position: new google.maps.LatLng(0.338581,32.5447),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow10 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/10-59-thumb.jpg' alt='Oeganda, 2005, Parish'><br><a href='/projecten/oeganda-2005-parish'><strong>Oeganda, 2005, Parish</strong></a>'
    });

    google.maps.event.addListener(marker10, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow10.open(map, marker10);

    open = infoWindow10;
    });



    var marker11 = new google.maps.Marker({
    position: new google.maps.LatLng(0.3,30.6),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow11 = new google.maps.InfoWindow({
    content: '<img src='http://www.wellwater.nl/images/projecten/9-54-thumb.jpg' alt='Oeganda, 2004, Bisozi'><br><a href='/projecten/oeganda-2004-bisozi'><strong>Oeganda, 2004, Bisozi</strong></a>'
    });

    google.maps.event.addListener(marker11, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow11.open(map, marker11);

    open = infoWindow11;
    });

    //begin van ding
    var marker12 = new google.maps.Marker({
    position: new google.maps.LatLng(52.129563,-3.777881),
    map: map,
    icon: 'http://school.infiniocorp.com/wellwater/site/HTML/images/marker.gif'
    });

    var infoWindow12 = new google.maps.InfoWindow({
    content: '<br><a href='#'><strong>Hier word het water opgepompt</strong></a>'
    });

    google.maps.event.addListener(marker12, 'click', function() {
    if(open !== null) {
    open.close();
    }

    infoWindow1.open(map, marker12);

    open = infoWindow12;
    });
    //end van ding

    }";

    ?>
    de uitkomst is hier te vinden: http://school.infiniocorp.com/wellwater ... php?zoom=4


    Wat heb ik verkeerd gedaan? Of werken javascriptjes niet zo...... (geen idee ofzo hoor)

    ALVAST HEEL ERG BEDANKT

    //xvilo

    EDIT:
    Dankzij krent op het het IRC is het opgelost! Ik had namelijk [s:26oxzp7h]met mijn lege hoofd[/s:26oxzp7h] alle [icode:26oxzp7h]" "[/icode:26oxzp7h]veranderd in [icode:26oxzp7h]' '[/icode:26oxzp7h] omdat php weird ging doen!

    Nu heb ik gewoon het scriptje er in staan en echo ik alleen het cijfer.... verder is alles gewoon puur text en ja! het werkt!
    « Laatst bewerkt op: januari 01, 1970, 01:00:00 am door Guest »