Hi all!
ich versuche meinen Javascript Code zu debuggen, finde aber keine Möglichkeit dazu außer "alert" Fenster!
hier ist das Codebeispiel: Alert Fenster "never reached" wird niemals ausgegeben!
Was passiert in der Google-Api bei "distanceFrom"?
Die Datei API Key muss angepasst werden mit dem Google Key (code.google.com). Alternativ deploye ich mit meinem eigenen Key unter
Test2 fr JS
ich versuche meinen Javascript Code zu debuggen, finde aber keine Möglichkeit dazu außer "alert" Fenster!
hier ist das Codebeispiel: Alert Fenster "never reached" wird niemals ausgegeben!
Was passiert in der Google-Api bei "distanceFrom"?
PHP-Code:
<?php include 'apikey.php' ?>
<html>
<head>
<title> Test2 für JS</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $api_key; ?>" type="text/javascript"></script>
<script type="text/javascript">
var firstCall = true;
const polyOptions = {geodesic:true};
var polyline = null;
var vertices = [new GLatLng(1,1), new GLatLng(2,2)];
var recenter = true;
function calculateLength() {
var pointCount = vertices.length;
var id;
//DEBUG (1, 1) (2, 2):
window.alert(vertices[0]);
window.alert(vertices[1]);
// Calculate total length of vertices
//DEBUG 2:
window.alert(pointCount);
if (pointCount >= 2) {
var length = 0;
//DEBUG 0:
window.alert(length);
for(id = 0; id < pointCount-1; id += 1) {
length += vertices[id].distanceFrom(vertices[id + 1]);
}
//DEBUG Never reached:
window.alert(length);
}
}
</script>
</head>
<body onload="calculateLength()">
</body>
</html>
Test2 fr JS
PHP-Code:
<?php
// Diese Datei ins Stammverzeichnis Ihres Servers
// $_SERVER['DOCUMENT_ROOT'] kopieren
if (strtolower($_SERVER["HTTP_HOST"])=='localhost') {
// Für localhost
$api_key="Ihr_Local_Schlüssel";
} else {
// Für öffentliche Seite
$api_key="Ihr_Public_Schluessel";
}
?
Kommentar