ie9 でこのエラーが発生し、髪を引っ張っています。基本的に「map-canvas」div は読み込まれません。
これは私が得ている完全なエラーです:
SCRIPT5007: プロパティ 'offsetWidth' の値を取得できません: オブジェクトが null または未定義の main.js、29 行目の文字 1104
どんな助けでも大歓迎です!!
これが私のコードです:
<!DOCTYPE html>
<html class="no-maps-mini" xmlns:v="urn:schemas-microsoft-com:vml">
<!-- Starts the HTML header area -->
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta content="text/html;charset=UTF-8" http-equiv="content-type"/>
<link rel="stylesheet" type="text/css" href="style/style.css" />
<title>Google Map Demo</title>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var tableid1 = 4338356; //Fusion Table ID
var mylatlng = new google.maps.LatLng(49.66685, -124.91038); //map centre - Courtenay/Comox
function initialize() {
var myOptions = {
scaleControl: true,
overviewMapControl: true,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DEFAULT
},
zoom: 14,
center: mylatlng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById('map-canvas'), myOptions);
var layer1 = new google.maps.FusionTablesLayer({
query: {
select: "'geometry'",
from: tableid1
},
map: map
});
};
function changeMapl() {
var searchString = document.getElementById('search-string-l').value.replace(/'/g, "\\'");
layerl.setOptions({
query: {
select: "'geometry'",
from: tableid1,
where: "'Name' = '" + searchString + "'"
}
});
};
google.maps.event.addDomListener(window, 'load', initialize());
</script>
</head>
<body>
<div id="container">
<div id="header">
<h1>Comox Valley Walking Trails</h1>
<hr />
</div><!-- end #header -->
<div id="content-secondary">
<h3>sidebar1 Content</h3>
<h4>Trails</h4>
<select id="search-string-l" onChange="changeMapl(this.value);">
<option value="">--Select--</option>
<option value="MacDonald Wood Park">MacDonald Wood Park</option>
<option value="Goose Spit">Goose Spit</option>
<option value="Mack Laing Park">Mack Laing Park</option>
<option value="Filberg Rd to Goose Spit">Filberg Rd to Goose Spit</option>
</select>
<div class="clear"></div>
</div>
<div id="content-primary"><div id="map-canvas"></div></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
<br class="clearfloat" />
<div id="footer">
<p>Footer</p>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>