IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

APIs Google Discussion :

Réaliser une page web avec une map google


Sujet :

APIs Google

  1. #1
    Membre du Club
    Homme Profil pro
    javascript,php
    Inscrit en
    Octobre 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : javascript,php
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 7
    Par défaut Réaliser une page web avec une map google
    Bonjours tout le monde,
    Je suis un nouveaux membre dans votre forums, après avoir réaliser ma page web à l'aide des instructions sur le lien http://javascript.developpez.com/faq/google-maps/
    je peux avoir comment ajouter une liste déroulant afin de changer la zone sur la carte, j'ai déjà essayer avec la fonction loadmap(latitude, longitude, zoom), ça ne marche pas voila mon code map.js,
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    function load(latitude, longitude, zoom) {
    		 var latitude=27.322779;
    			var	longitude=-12.849722;
    			var	zoom=8; 
    		var zone=parent.head.document.getElementById('zone').value;
    		 if(zone=='laayoune'){
    				  latitude=27.160586;
    				longitude=-13.2122;
    				zoom=16; 
    			   }
    			   if(zone=='plage'){
    				  latitude=27.056986;
    				longitude=-13.424266;
    				zoom=16; 
    			   }
    			   if(zone=='boucraa'){
    				  latitude=26.324602;
    				longitude=-12.852154;
    				zoom=16; 
    			   }
    	 var i ;
          map = new google.maps.Map(document.getElementById("map"), {
     
    		center: new google.maps.LatLng(latitude,longitude),
            zoom: zoom,
            mapTypeId: 'roadmap'
           });
    j'ai besoin de votre aide par ce que c'est mon projet de stage de fin d'études, merci.
    Fichiers attachés Fichiers attachés
    • Type de fichier : js map.js (8,1 Ko, 163 affichages)

  2. #2
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    Bonsoir et bienvenue sur DVP,
    tu places tes données dans la value des OPTIONs et sur le onchange du SELECT tu appelles la fonction de remise à jour
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <select onchange="modifCentre(this);">
      <option value="27.322779;-12.849722;8;">ICI</option>
      <option value="27.160586;-13.2122;16;">laayoune</option>
      <option value="27.056986;-13.424266;16;">plage</option>
      <option value="26.324602;-12.852154;16">boucraa</option>
    </select>
    dans la fonction modifCentre, tu split() la value pour récupérer les différentes valeurs que tu appliques à la carte
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    function modifCentre(obj){
      var data = obj.value.split(';');
      var latitude=  parseFloat( data[0]);
      var longitude = parseFloat( data[1]);
      var zoom = parseFloat( data[2]);
      // il ne te reste plus qu'à appliquer à ta map
    }

  3. #3
    Membre du Club
    Homme Profil pro
    javascript,php
    Inscrit en
    Octobre 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : javascript,php
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 7
    Par défaut
    Merci,
    toujours le méme erreur "google est indéfinie"

  4. #4
    Expert éminent

    Avatar de vermine
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    6 582
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2008
    Messages : 6 582
    Par défaut
    Bonjour et bienvenue,

    Avez-vous bien référencé Google Maps ?

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>

    Avez-vous effectivement une <div> dont l'id est "map" ?

  5. #5
    Membre du Club
    Homme Profil pro
    javascript,php
    Inscrit en
    Octobre 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : javascript,php
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 7
    Par défaut botch_nor
    Oui, j'ai référencé google dans le fichier map.html et le <div> avec "map" comme id :

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <body onLoad="load()">
        <div id="map" style="width: 1000px; height: 448px"></div>

    Mais la liste déroulante est dans un header.php quand j'ai reçu ta réponse, j'ai essayé de référencer google dans ce fichier header.php. Ca ne marche toujours pas, je fais un autre essai, c'est de copier la balise body qui contient la fonction load et la balise div avec l'id "map" dans le fichier header qui contient la liste, et bon ça marche mais dans le haut de la page. Voila je t'ai envoyé les deux fichiers pour m'expliquer ou se trouve l'erreur, merci pour ton aide.
    Fichiers attachés Fichiers attachés

  6. #6
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    il serait sain que tu regardes le fichier HTML généré, il semblerait que pas mal de surprises t'attendent.

    Remets de l'ordre la dedans pour commencer

  7. #7
    Membre du Club
    Homme Profil pro
    javascript,php
    Inscrit en
    Octobre 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : javascript,php
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 7
    Par défaut botch_nor
    Bonjour, Mr NoSmoking dans tous ces jours j'ai essayé de résolus le problème de ma liste déroulante le code map.js est bien effectuer mais comment je peux réaliser la liste sous la map ?

  8. #8
    Membre régulier
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Octobre 2012
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2012
    Messages : 10
    Par défaut
    Salut botch_nor,

    Regarde la doc Google ça peut peut-être t'aider,
    https://developers.google.com/maps/d...ipt/directions

    Slautations.

  9. #9
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    @patcino
    Citation Envoyé par patcino Voir le message
    Salut botch_nor,

    Regarde la doc Google ça peut peut-être t'aider,
    https://developers.google.com/maps/d...ipt/directions

    Slautations.
    pas sûr que cela soit ce que cherche botch_nor, sauf si j'ai mal saisi le problème.


    @botch_nor il faudrait que tu nous montres le code HTML généré, comme précisé ci dessus, et ce bien sûr après épuration, pour que l'on voient où cela ne va pas.

    En attendant voici un exemple de ce que l'on peut réaliser, sur base de ce que j'ai indiqué plus haut.
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    <!DOCTYPE html>
    <html lang="fr">
    <head>
    <meta charset="UTF-8">
    <title>Affichage après sélection...</title>
    <style type="text/css">
    html, body {
      height : 100%;
      margin : 0;
      padding :0;
      font-family : Verdana;
      font-size : 1em;
      background-color : #F8F8F8;
    }
    h1{
      font-size:1.5em;
      margin:0;
      padding:0.5em;
    }
    h1 img{
      vertical-align : middle;
    }
    #page {
      position:relative;
      width:50em;
      min-height:100%;
      margin:0 auto;
      padding:0;
      border-left: 1px solid #B0B0FF;
      border-right:1px solid #B0B0FF;
      background-color:#FFF;
      overflow:hidden;
    }
    #header{
      font-size:0.9em;
      margin:0px;
      background-color:#E1E4F2;
      border-bottom:1px solid #B0B0FF;
    }
    #header h1{
      color:#006699;
      font-style:normal;
      padding-top:0.5em;
      text-shadow:1px 1px 0px #FFF;
    }
    #header span {
      float: right;
      font-size: 0.6em;
      font-style: italic;
    }
    #content{
      overflow: hidden;
      padding: 10px;
      padding-bottom: 2.5em;  /* hauteur pied de page */
    }
    #footer{
      position:absolute;
      bottom:0;
      left:0;
      width:100%;
      padding:0.5em;
      background-color:#F5F5F5;
      border-top:1px solid #B0B0FF;
      overflow:hidden;
    }
    #footer p{
      margin:0;
      padding:0;
      font-size:0.7em;
      line-height:1em;
    }
    #footer a{
      color:#00F;
      text-decoration:none;
    }
    #cadre_carte {
      margin:0 auto;
      padding:5px;
      width:600px;  /* largeur effective 610px */
      height:600px;
      border:1px solid #888;
      overflow:hidden;
    }
    #carte {
      height:600px;
      width:600px;
      margin:auto;
    }
    #cde{
      position:relative;
      margin:5px auto;
      padding:5px;
      width:600px;
      background-color:#F5F5F5;
      border:1px solid #888;
      z-index:1000;
    }
    #info{
      padding:0 1em;
      font-size:0.8em;
      text-align: justify;
    }
    .controle {
      font:0.8em Verdana;
      padding:1px;
      margin:0 5px 0 0;
      width: 10em;
      background-color:#FFF;
      border:1px solid #808080;
      cursor:pointer;
    }
    code{
      color:#00F;
      font: 1em "Courier New", monospace;
    }
    </style>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
    function initCarte(){
      //Création de la MAP
      var oCarte = new google.maps.Map(document.getElementById("carte"),{
        'center': new google.maps.LatLng(46.80, 1.70),
        'zoom': 6,
        'backgroundColor' : '#fff',
        'streetViewControl' : false,
        'noClear' : true,
        'zoomControlOptions' : {
          'style' : google.maps.ZoomControlStyle.SMALL
        },
        'mapTypeId': google.maps.MapTypeId.ROADMAP
      });
     
      // affectation fonction sur le onchange du select
      document.getElementById('choix_ville').onchange = function(){
        // recup. des données
        var data = this.value.split(';'),
            latitude  = parseFloat( data[0]),
            longitude  = parseFloat( data[1]),
            zoom = data[2] ? parseFloat( data[2]) : oCarte.getZoom();
        // mise en place du zoom
        oCarte.setZoom( zoom);
        // recentrage de la carte
        oCarte.setCenter( new google.maps.LatLng( latitude, longitude));
      };
    }
    google.maps.event.addDomListener( window, 'load', initCarte);
    </script></head>
    <body>
    <div id="page">
      <div id="header">
        <h1><span>[Google Maps API V3]</span>Affichage après sélection</h1>
      </div>
      <div id="content">
        <div id="info">
        </div>
        <div id="cde">
          <select id="choix_ville" class="controle">
            <option value="46.80; 1.70;6">France</option>
            <option value="44.84;-0.58;12">Bordeaux</option>
            <option value="45.76; 4.84;12">Lyon</option>
            <option value="43.30; 5.37;12">Marseille</option>
            <option value="48.86; 2.34;12">Paris</option>
          </select>
        </div>
        <div id="cadre_carte">
          <div id="carte"></div>
        </div>
      </div>
      <div id="footer">
        <p>Auteur : <a href="http://www.developpez.net/forums/u405341/nosmoking/" target="DVP">NoSmoking</a> pour <a href="http://web.developpez.com/" target="DVP">developpez.com</a></p>
      </div>
    </div>
    </body>
    </html>

  10. #10
    Membre du Club
    Homme Profil pro
    javascript,php
    Inscrit en
    Octobre 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : javascript,php
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 7
    Par défaut botch_nor
    je n'ai pas un seul fichier qui génère la page, un fichier javascript contient le code qui appel la map
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    // JavaScript Document
     
        //<![CDATA[
     
        var map ;
    	var lines=[];
    	var line=[];
    function ajaxRequest(){
     var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
     if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
      for (var i=0; i<activexmodes.length; i++){
       try{
        return new ActiveXObject(activexmodes[i])
       }
       catch(e){
        //suppress error
       }
      }
     }
     else if (window.XMLHttpRequest) // if Mozilla, Safari etc
      return new XMLHttpRequest()
     else
      return false
    }		
     
    			function ping(id){
    					parent.objets.location="ping.php?pingName="+id;
     
    			}
    			function ActDir(id){
     
    				parent.objets.location="noPage.php";
    				var xhr=new ajaxRequest();
     
     
     
    			xhr.onreadystatechange = function() {
     
    				if(xhr.readyState == 4 && (xhr.status == 200 || window.location.href.indexOf("http")==-1)) {
     
     
    						parent.objets.document.getElementById('secretDiv').innerHTML=xhr.responseText;
    				}
    			}
     
    var parameters="id=" + id ;
    xhr.open("POST", "active.php", true);
    xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhr.send(parameters);
     
    			}
        function load() {
    		 var latitude=27.322779;
    			var	longitude=-12.849722;
    			var	zoom=8; 
    		var zone=parent.head.document.getElementById('zone').value;
    		 if(zone=='laayoune'){
    				  latitude=27.160586;
    				longitude=-13.2122;
    				zoom=16; 
    			   }
    			  else if(zone=='plage'){
    				  latitude=27.056986;
    				longitude=-13.424266;
    				zoom=16; 
    			   }
    			   else if(zone=='boucraa'){
    				  latitude=27.160586;
    				longitude=-13.2122;
    				zoom=16; 
    			   }
    	 var i ;
          map = new google.maps.Map(document.getElementById("map"), {
     
    		center: new google.maps.LatLng(latitude,longitude),
            zoom: zoom,
            mapTypeId: 'roadmap'
          });
     
          var infoWindow = new google.maps.InfoWindow;
          downloadUrl("word.php", function(data) {
            var xml = data.responseXML;
            var markers = xml.documentElement.getElementsByTagName("place");
    	    var armoire=[];
     
     
    		var point2=[]
    		var address=[];
    		var end=false;
    		for (var i = 0; i < markers.length; i++) {
     
    		armoire=[];
     
              var adress = markers[i].getAttribute("batiment"); 
              var type = markers[i].getAttribute("etage");
     
            var  point = new google.maps.LatLng(
                  parseFloat(markers[i].getAttribute("latitude")),
                  parseFloat(markers[i].getAttribute("longitude")));
    			   var j=i+1;
     
    			   if(j<=markers.length && i!=markers.length && !end){
    			  armoire.push(markers[i].getAttribute("marque"));
    			   var model=markers[i].getAttribute("adresse");
    			    var serie=markers[i].getAttribute("serie");
    				var id=model;
     
     
    		 armoire.push( ["<table align='center'><tr><td> Address:" + model +" </td><td> ",
        "<input type='button' id='map-go' value='PING' onclick=\"ping('"+id+"')\" /></td></tr></table>"].join(""));
     
    			  var boucle=true;
     
    			  while(j != markers.length && boucle){
     
    			  	if(markers[i].getAttribute("idfils")== markers[j].getAttribute("idfils")){
    				armoire.push(markers[j].getAttribute("marque"));
    				 var model=markers[j].getAttribute("adresse");
    				  var serie=markers[j].getAttribute("serie");
    		 		var id=model;
     
     
    		  armoire.push( ["<table align='center'><tr><td>Address:"+ model +"</td><td>",
        "<input type='button' id='map-go' value='PING' onclick=\"ping('"+id+"')\" /></td></tr></table>"].join(""));
    	  boucle=true; j++;
    				  if(j>markers.length){
    				  	end=true;
    				  }
    				}
     
    				else{
     
    					i=j-1;
     
    					boucle=false;
    				}
     
     
     
     
     
    			  }
    			  var active = markers[i].getAttribute("idfils");
    		var user	= [ "<table align='center'><tr><td>"  +active+  "</td><td><input type='button' id='map-go' value='Active directory'  onclick=\"ActDir('"+active+"')\" /></td></tr></table>"].join("");
    			  armoire.push( user );
     
    			 var  html = "<b>Emplacement : " + type + "</b> <br/>" + address +"<b><table>";
    			 for(var g=0;g<armoire.length;g++){
     
    				 html+="<tr><td>"+armoire[g] +"</td></tr>" ;
    			 }
    			 html+="</table>";
     
     
    			 var icon1 = new google.maps.MarkerImage("img/armoire.png", null, null, null, new google.maps.Size(50, 50));
    			 var marker = new google.maps.Marker({
                map: map,
                position: point,
                icon: icon1,
    		title: type,
    			draggable : false
             		 });
     
     
     
    		 bindInfoWindow(marker, map, infoWindow, html);
    			 }
    			 }
    			  var liens = xml.documentElement.getElementsByTagName("liens");
     
    			 var point;
    			 var points=[];
    			 for(var i=0;i<liens.length;i++){
    			 	point=[];
     
     
    							point.push(liens[i].getAttribute("idlien"));
    							point.push(liens[i].getAttribute("idfils"));
    							point.push(liens[i].getAttribute("idparent"));
    							var trouveFils=false;
    							var trouveParent=false;
    							var j=0;
     
    							 while(!trouveFils && j<markers.length){
    							 if(markers[j].getAttribute("idfils")==liens[i].getAttribute("idfils")){
    							 	point.push(markers[j].getAttribute("latitude"));
    								point.push(markers[j].getAttribute("longitude"));
    								trouveFils=true;
    							 }
     
    							 j++;
    							 }
    							 var j=0;
    							 while(!trouveParent  && j<markers.length){
    							 if(markers[j].getAttribute("idfils")==liens[i].getAttribute("idparent")){
    							 	point.push(markers[j].getAttribute("latitude"));
    								point.push(markers[j].getAttribute("longitude"));
    								trouveParent=true;
    							 }
     
    							 j++;
    							 }
     
     
    							var boolean=false;
    							for(var x=0;x<points.length;x++){
    								if((points[x][1]==point[1] && points[x][2]==point[2]) || (points[x][2]==point[1] && points[x][1]==point[2])){
    									boolean=true;
    								}
    							}
    							if(!boolean){
    								points.push(point);
    							}
     
    							point=[];
     
     
    			 }
     
    			 var tableauPointsPolyline;
    			 var optionsPolyline;
    			 var maPolyline;
    			  for(var i=0;i<points.length;i++){
     
    					tableauPointsPolyline=[];
     
    					line.push(points[i]);
     
    					 tableauPointsPolyline = [
    					new google.maps.LatLng(points[i][3],points[i][4]),
    					new google.maps.LatLng(points[i][5],points[i][6])
    				];
    				 optionsPolyline = {
     
    					map: map,
    					strokeColor: 'cyan',
    					path: tableauPointsPolyline
    				};
     
    				 maPolyline = new google.maps.Polyline(optionsPolyline);
    				 line.push(maPolyline);
    				lines.push(line);
    				line=[];
     
     
    			 }
     
     
     
     
    		});
     
     
        }
    	function bindInfoWindow(marker, map, infoWindow, html) {
          google.maps.event.addListener(marker, 'click', function() {
            infoWindow.setContent(html);
            infoWindow.open(map, marker);
          });
     
     
        }
     
        function downloadUrl(url, callback) {
          var request = window.ActiveXObject ?
              new ActiveXObject('Microsoft.XMLHTTP') :
              new XMLHttpRequest;
     
          request.onreadystatechange = function() {
            if (request.readyState == 4) {
              request.onreadystatechange = doNothing;
              callback(request, request.status);
            }
          };
     
          request.open('GET', url, true);
          request.send(null);
        }
     
        function doNothing() {}
    	function setColorLines(lignes){
    	for(var j = 0; j < lines.length; j++){
    	lines[j][1].setOptions({strokeColor:"#EEEE00"});
    	}
    		for(var i = 0; i < lignes.length; i++){
    		for(var j = 0; j < lines.length; j++){
     
    				if(lines[j][0][0]==lignes[i]){
    					lines[j][1].setOptions({strokeColor:"#FF0000"});
    						}
     
    			}
    			}	
    	}
    	function panne(id){
     
    				preparerMatrice(lines,id,'LV5');
     
    			}		
    			function setColor(id){
     
    				for(var i=0;i<lines.length;i++){
    					lines[i][1].setOptions({strokeColor:"#EEEE00"});
    					if(lines[i][0][0]==id){
     
    						lines[i][1].setOptions({strokeColor:"#FF0000"});
    					}		
    				}
    			}		
        //]]>
    , le fichier qui génère la carte
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google Maps AJAX + mySQL/PHP Example</title>
    	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
        <script src="http://maps.google.com/maps/api/js?sensor=false"
                type="text/javascript"></script>
    			<script language="javascript" type="text/javascript" src="js/PreparerMatrice.js"></script>
    			   <script type="text/javascript" language="javascript" src="map.js">
     
      </script>
     
    <style type="text/css">
    #map_canvas{
        width: 400px; 
        height: 300px;
    }
    .contextmenu{
        visibility:hidden;
        background:#ffffff;
        border:1px solid #8888FF;
        z-index: 10;  
        position: relative;
        width: 140px;
    }
    .contextmenu div{
        padding-left: 5px
        }
     
    </style>
      </head>
     
      <body onLoad="load()">
        <div id="map" style="width: 1000px; height: 448px"></div>
     
      </body>
    </html>
    , la liste déroulante est dans un autre
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
     
     
    <!DOCTYPE html>
    <html lang="fr">
    	<head>
    		<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    		<meta charset="UTF-8" />
    		<title>Reseau informatique Phosboucraa</title>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>	
    		<script language="javascript" type="text/javascript" src="Script1.js">
    </script>
    <script language="javascript" type="text/javascript" src="map.js">
    </script>
    <style type="text/css">
     
    .nav .current a	{
    	background: url(img/pro_line_1.gif);
    	color: #fff;
    	display: block;
    	float: left;
    	height: 37px;
    	line-height: 35px;
    	padding: 0 0 0 10px;
    	text-decoration: none;
    	white-space: nowrap;
    	}
     
     
     
     
    </style>
    	</head>
     
     
    	<body bgcolor="#E6E6E6">
     
     
     
    <div id="gestion" >
     
      <div align="center">
      <div align="center" width="8%" ><img src="img/logoCarephos.gif" alt="3" width="100" height="50" align="left"></div>
        <div align="center" width="8%"><img src="img/Ocp.jpg" alt="3" width="100" height="50" align="right"></div>
        <table width="72%" border="2" bordercolor="#000000"  align="center" bgcolor="#FFFFFF">
          <tr align="center">
            <td width="12%" height="22" class="current" id="browser"><a   href="#" onClick="change_menu('interroger','')" >Interroger un excel</a></td>
          <td width="12%"><a id="ajouter" href="#" onClick="change_menu('objet','ajouter'),change_operation('ajouter')">Nouveau</a></td>
          <td width="12%"><a id="modifier" href="#" onClick="change_operation('modifier'),change_menu('objet','modifier')">A modifier</a></td>
          <td width="12%"><a id="supprimer" href="#" onClick="change_menu('objet','supprimer'),change_operation('supprimer')">A supprimer</a></td>
          <td width="12%"><a id="panne" href="#" onClick="affciherPanne()">Pannes</a></td>
          <td width="12%"><a id="chemincritique" href="#" onClick="affciherCheminCritique()">Chemin critique</a></td>
          <td width="12%"><a href="#" ><select name="zone" id="zone" onChange="load()"><option value="laayoune">Laayoune</option><option  value="plage">La plage</option><option  value="boucraa">Boucraa</option></select></a></td>	
          </tr>
        </table>
      </div>
    </div>
     
     
     
     
    </body>
    </html>
    ,

  11. #11
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    au final UN SEUL fichier est affiché, sauf si présence de (I)FRAME.

    Là tu es en train de mettre un fichier dans le BODY d'un autre fichier, c'est n'importe quoi .

    Il te faut réaliser un fichier final SAIN.

  12. #12
    Membre du Club
    Homme Profil pro
    javascript,php
    Inscrit en
    Octobre 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : javascript,php
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 7
    Par défaut botch_nor
    où ????????????????

  13. #13
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    Citation Envoyé par botch_nor Voir le message
    où ????????????????
    je dois admettre que je ne comprends pas cette interrogation

    Un fichier SAIN est un fichier qui possède une structure saine
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    <!DOCTYPE html>
    <html lang="fr">
    <head>
    <meta charset="UTF-8">
    <title>Ma page</title>
    <style type="text/css">
    /* ICI les déclarations de style mais tu peux les mettre dans un fichier externe */
    </style>
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
    <script type="text/javascript">
    /* ici le code JS mais il est préférable de le mettre dans un fichier externe */
    </script>
    </head>
    <body>
    <!-- ICI le code HTML de la page -->
    </body>
    </html>
    dans ton cas on est bien loin de cela.

  14. #14
    Membre du Club
    Homme Profil pro
    javascript,php
    Inscrit en
    Octobre 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : javascript,php
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 7
    Par défaut botch_ nor
    où ai je mis un fichier dans le body d'un autre ?

  15. #15
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    Il te suffit d'observer le code HMTL généré pour te rendre compte que la structure résultante de ton fichier n'est pas terrible.

    Pour visualiser le code touches CTRL +U

Discussions similaires

  1. Rafraichir une page web avec une condition
    Par Thomas77380 dans le forum Général JavaScript
    Réponses: 36
    Dernier message: 12/05/2011, 11h27
  2. Réponses: 0
    Dernier message: 01/04/2009, 19h29
  3. Voir plusieurs pages web dans une page web
    Par lfa44 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 6
    Dernier message: 23/06/2007, 09h27
  4. [CSS] impression d'une page web en une page
    Par beegees dans le forum Mise en page CSS
    Réponses: 4
    Dernier message: 09/09/2006, 18h12
  5. diriger une page web vers une page php
    Par moonia dans le forum Langage
    Réponses: 7
    Dernier message: 11/04/2006, 11h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo