English 中文(简体)
谷歌地图 预报器:检测地点和降低标识
原标题:Google Maps API: Detecting location and dropping a marker

利用谷歌实例代码探测用户地点,我设立了一个基本网页,在地图上探测用户的位置。 我还设立了一个单独的网页,在具体协调的地图上贴上标识。 我想将这些职能合并为一个文字。 这就是说,我想在所探测地点地图上贴上一个标识,但我看不去做。 我的代码检测了用户的位置,但并没有下降标记。 我确信,这只是一个简单的问题,但我不熟悉Javascript,因此我不敢解决问题。

下面是谷歌实例代码。 我要补充的是,在最初的Location上显示标记是什么? 我试图增加以下法典:

    var marker = new google.maps.Marker({
        position: initialLocation,
        map: map,
        title: "You are here"
});

Google s example code

最佳回答

Try calls setMap( 在你创建标识之后:

var marker = new google.maps.Marker({
    position: initialLocation,
    map: map,
    title: "You are here"
});
marker.setMap(map);
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签