我正在尝试使用googlemaps地理位置创建基本网页。我很容易嵌入地图,但无法让“找我按钮”工作。我做错了什么?
<!DOCTYPE html>
<html lang="">
<head>
<title></title>
</head>
<body>
<a href="#" id="get_location">Find Me</a>
<div id="map">
<iframe id="google_map" width="425" height ="350" frameborder="0" scrolling="no" marginheight="0" marginwidth = "0" src="https://maps.google.co.uk?output=embed"></iframe>
</div>
<script>
var c =function (pos) {
var lat = pos.coords.latitude,
long = pos.coords.longitude,
coords = lat + ', ' + long;
document.getElementById('google_map').setAttribute('src', 'https://maps.google.co.uk/?q=' + coords + '&z=60&output=embed');
document.getElementById('get_location').onclick = function () {
navigator.geolocation.getCurrentPosition(c);
return false;
}
</script>
</body>
</html>
“查找我”按钮不起作用。有什么想法吗?
答案 0 :(得分:0)
你缺少c()函数的右括号。
<?php
$url = "http://www.google.com";
$row = array("image" => "image.png");
echo "document.write('<a href=\"$url\"> <img src=\"".$row["image"]."\" border=0 /> </a>');";
// output: document.write('<a href="http://www.google.com"> <img src="image.png" border=0 /> </a>');
?>