HTMLWorld - HTML, CSS, JavaScript, PHP, Java, Flash und vieles mehrHTMLWorld:   Home | Impressum
 

 
 

Anzeige 
 
HTMLWorld » Forum

Thema anzeigen - Problem mit Blätterfunktion

 FAQFAQ   SuchenSuchen   MitgliederlisteMitgliederliste   BenutzergruppenBenutzergruppen   RegistrierenRegistrieren 
 ProfilProfil   Einloggen, um private Nachrichten zu lesenEinloggen, um private Nachrichten zu lesen   LoginLogin 

Problem mit Blätterfunktion

 

Neues Thema eröffnen   Neue Antwort erstellen    HTMLWorld Foren-Übersicht
   JavaScript
Vorheriges Thema:
Nächstes Thema:  
Autor Nachricht
maffy



Anmeldungsdatum: 17.04.2007
Beiträge: 2
Wohnort: Bad Bocklet

BeitragVerfasst am: 17.04.2007 18:15:21    Titel: Problem mit Blätterfunktion Antworten mit Zitat

Ich versuche für die Marker in der Googel Map eine Blätterfunktion zu erstellen. Aber es wird keine Blätterfunktion angezeigt.

Evt gibt es auch eine bessere Lösung?


Code:

<script type="text/javascript">
    //<![CDATA[

    if (GBrowserIsCompatible()) {
     
      // this variable will collect the html which will eventualkly be placed in the side_bar
      var side_bar_html = "";
     var text = "";
       
      // arrays to hold copies of the markers and html used by the side_bar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var i = 0;
      
    
     var baseIcon = new GIcon();
      baseIcon.iconSize=new GSize(25,25);
      baseIcon.shadowSize=new GSize(25,25);
      baseIcon.iconAnchor=new GPoint(16,32);
      baseIcon.infoWindowAnchor=new GPoint(10,0);
           
      var martini = new GIcon(baseIcon, "../images/poi.png", null, "../images/poish.png");
 
      // A function to create the marker and set up the event window
      function createMarker(point,lid,name,html,icon) {
       
      var marker = new GMarker(point,icon);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
           
                      
        });
            
       // The new marker "mouseover" listener       
        GEvent.addListener(marker,"mouseover", function() {
         marker.openInfoWindowHtml(html);
         
      });

        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        htmls[i] = html;
         
        // add a line to the side_bar html
        side_bar_html += ' <div class=eintrag>' + lid + ' <a href="javascript:myclick(' + i + ')">' + name + '</a> </div>';
        i++;         
        return marker;
      
      }


     // This function picks up the click and opens the corresponding info window
      function myclick(i) {
           gmarkers[i].openInfoWindowHtml(htmls[i]);
         
      }

      // create the map
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
     map.setCenter(new GLatLng(50.460131, 9.87227), 9);
      // add the points   

   <?PHP
               
   ########################################################
   # Ausflugsziele in der gewählten Kategorie anzeigen
   ########################################################
   
   if ($cid){
   
   // Wie viele Eintraege gleichzeitig anzeigen?
   $step = 10;
      
   // Blätterfunktion - Anzahl der Daten
   $start = (isset($_GET['start'])) ? $_GET['start'] : 0;
   $start = (isset($_POST['start'])) ? $_POST['start'] : 0;
   
   // Anzahl der Datensätze
   $sql2    = mysql_query("SELECT COUNT(*) as anzahl FROM rf_ziele WHERE KATEGORIE = $cid AND VERIFIZIERT = 1 ");
   
   $temp = mysql_fetch_array($sql2);
   $anzahl = $temp["anzahl"];
                
   // Alle Daten holen
   $result = mysql_query("   SELECT * FROM rf_ziele
                     WHERE KATEGORIE = ".$cid."
                     AND VERIFIZIERT = 1
                     ORDER By ID DESC
                     LIMIT ".$start.", ".$step." ");
   
   // Neue Nummerierung der Datensätze   
   $i = 0;
   $num_start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
   $row_number = $i + ( $num_start + 1 );
      
   // Daten anzeigen
   while($row = mysql_fetch_array($result))
   {
   
   echo "var point = new GLatLng(" . $row['LON'] . "," . $row['LAT'] . ");\n";
   echo "var marker = createMarker(point,'".$row_number++."','<span>".$row['OBJEKT']."</span>','<div class=\"infobox\"><u><strong>".$row['OBJEKT']."</strong></u><br /><br />".$row['KURZTEXT']."<br /><br /><a href=index.php?ausflug&do=details&id=" . $row['ID'] . ">Details</a> — <a href=index.php?gemeinde&do=list&loc_id=" . $row['GS'] . ">Gemeinde Steckbrief</a> <br /> <br /> <strong> Geodaten:</strong> ".$row['LAT']." - ".$row['LON']." </div>', martini);\n";
   echo "map.addOverlay(marker);\n";
   echo "\n";
   }
   
   mysql_close();
   
   // Blätterfunktion ausgeben
   $start1 = $start + $step;
     $start2 = $start - $step;
   
   for ($z = 0;$anzahl > $z;$z = $z + $step) {
      $anf = $z + 1;
        $end = $z + $step;
         if ($end > $anzahl) {
           $end = $anzahl;
         }

         if ($anf == $end && $start != $z) {
            $count = "[ <a href=\"maptest3.php?cid=$cid&amp;start=$z\">$end</a> ] ";
         } else if ($anf == $end) {
           $count .= "[ $end ] "; // neu: hier kein Hyperlink!
         } else if ($start != $z) {
           $count .= "[ <a href=\"maptest3.php?cid&amp;cid=$cid&amp;start=$z\">$anf-$end</a> ] ";
         } else {
           $count .= "[ $anf-$end ] ";  // neu: kein Hyperlink!
         }
    }
   

   // put the assembled side_bar_html contents into the side_bar div
   echo " var text = '  ".$count." Datensatz  ' ;\n";
      
   }
      

            
   ?>
     
   // put the assembled side_bar_html contents into the side_bar div
      document.getElementById("side_bar_text").innerHTML = text;
              
   // put the assembled side_bar_html contents into the side_bar div
      document.getElementById("side_bar").innerHTML = side_bar_html;
     
    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }


    //]]>
    </script>



Mfg Maffy
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden E-Mail senden Website dieses Benutzers besuchen
Beiträge der letzten Zeit anzeigen:   
Neues Thema eröffnen   Neue Antwort erstellen    HTMLWorld Foren-Übersicht
   JavaScript
Alle Zeiten sind GMT + 1 Stunde
Seite 1 von 1

 
Gehe zu:  
Du kannst keine Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum nicht antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.