<!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>
<style type="text/css"><!--
.mapMessage {
border:1px gray solid;
color:red;
background-color:white;
padding:5px;
white-space:nowrap;
}
--></style>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAasAJryKxWJnBFVJa487d9hTHGAxTVT7IRADYa-JdYz7xQ8IQZBSthgDZdggYpQHsmm6WYtHstQFfLA" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
window.onload = function() {
map = new GMap2(document.getElementById("gmap"));
map.setCenter(new GLatLng(36, 137), 6);
}
function displayMessage() {
var divObj = document.createElement("div");
divObj.innerHTML = document.getElementById("message").value;
divObj.className = "mapMessage";
map.getPane(G_MAP_MAP_PANE).appendChild(divObj);
}
//]]>
</script>
<div id="gmap" style="width: 500px; height: 400px"></div>
<form>
<input type="text" value="ここが日本です" id="message" />
<input type="button" value="マップ上に文字を表示" onClick="displayMessage()" />
</form>
</body>
</html>