目前我有一张工作地图,可以使用"找我"自动找到我的位置。按钮我添加了。我想将此更改为具有用户可以在任何位置键入的表单。我该如何改变呢?我是初学者,提前谢谢。
class Player
has_many :player_frames
has_many :frames, through: :player_frames
end
class Frame
has_many :player_frames
has_many :players, through: :player_frames
end
class PlayerFrames
belongs_to :player
belongs_to :frame
end
答案 0 :(得分:0)
此代码似乎使用链接作为按钮,如下所示:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<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>
<form>
Latitude:<br>
<input type="text" id="latitude"><br>
Longitude:<br>
<input type="text" id="longitude">
</form>
<a href="#" id="get_location">Find This</a>
<script>
document.getElementById('get_location').onclick = function () {
var lat = document.getElementById('latitude').value
var long = document.getElementById('longitude').value
coords = lat + ', ' + long;
document.getElementById('google_map').setAttribute('src', 'https://maps.google.co.uk/?q=' + coords + '&z=60&output=embed');
}
</script>
</body>
</html>