デバッグ(ログウィンドウ表示)

説明

デバッグに便利なのがログウィンドウへの表示です。ログウィンドウへの文字の表示はGLog.write()、GLog.writeHtml()で行います。GLog.write()の二番目のパラメータにはカラー名またはカラーコードを指定できます。ログにURLを表示するにはGLog.writeUrl()を使いパラメータには表示するURLを指定します。
逆引きGoogle Maps APIリファレンス  詳しい解説などは逆引きGoogle Maps APIリファレンス、またはGoogle Maps APIリファレンスを参照してください。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Sample</title>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAasAJryKxWJnBFVJa487d9hTHGAxTVT7IRADYa-JdYz7xQ8IQZBSthgDZdggYpQHsmm6WYtHstQFfLA" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
window.onload = function() {
map = new GMap2(document.getElementById("gmap"));
map.setCenter(new GLatLng(37, 138), 6);
GLog.write("デバッグに便利です");
GLog.write("色も指定することができます", "#ff0000");
GLog.writeHtml("HTMLタグも<b>反映され</b>ます");
GLog.writeUrl("http://www.openspc2.org/");
}
//]]>
</script>
</head>
<body>
<div id="gmap" style="width: 500px; height: 400px"></div>
</body>
</html>