草庐IT

ready-api

全部标签

javascript - google maps api 无法读取 placesservice

我在使用GooglemapAPI及其PlacesService时遇到问题。即使我已经正确加载了地点库,它仍然说“无法读取未定义的属性‘PlacesService’”。map本身可以工作并加载。有任何想法吗?这是代码:varmyLatlng;varmap;varmarker;functioninitialize(){myLatlng=newgoogle.maps.LatLng(fooLat,fooLng);varmapOptions={zoom:17,center:myLatlng,mapTypeId:google.maps.MapTypeId.ROADMAP,scrollwheel:f

javascript - 使用 Google map api V3 ASP.net 绘制多条不同颜色的多段线

我可以在谷歌地图中绘制多条折线并设置它们的样式,但我想用不同的颜色为每条折线着色。目前,我有这段代码:varDrivePath=[newgoogle.maps.LatLng(37.772323,-122.214897),newgoogle.maps.LatLng(21.291982,-157.821856),newgoogle.maps.LatLng(-18.142599,178.431),newgoogle.maps.LatLng(-27.46758,153.027892),newgoogle.maps.LatLng(12.97918167,77.6449),newgoogle.ma

javascript - 访问 $(document).ready() 和 jquery 之外的变量

所以我有一个包含在我的html中的.js文件如果我将其放入我的.js文件中,$(document).ready(function(){varsiteRoot=$('.site-root').val();alert(siteRoot);});代码会正确地提醒值,但如果我这样做:varsiteRoot=$('.site-root').val();$(document).ready(function(){alert(siteRoot);});它会警告undefined而不是有没有办法让$(document).ready()中的内容访问其外部的变量,因为如果我将变量放入$(document).

javascript - 谷歌地图 API 函数 map.getCenter()

当用户调整他的map时,我将GoogleMapAPI设置的缩放和位置保存在cookie中。当他们回来时,map还在​​同一个地方。该功能大部分时间都有效:varh=JSON.stringify(map.getCenter(),null,2);jQuery.cookies.set("YD44635center",h,cookieOptions);在解码端使用:locationVar=jQuery.cookies.get("YD44635center");vartemp="";//fortesting:for(varxinlocationVar){temp+=x+"\n";}alert(t

javascript - 由于内容安全政策,谷歌地图 api 脚本确实加载

我正在制作一个谷歌浏览器扩展程序,我想在其中使用谷歌地图。问题是当我运行我的脚本时,它给了我这个错误Refusedtoloadscriptfrom'https://maps.googleapis.com/maps/api/js?key=XXXXXXXXXXXXXXXX&sensor=false'becauseofContent-Security-Policy.这是我的list文件{"name":"Name","version":"1.0","manifest_version":2,"background":{"scripts":["js/script.js"]},"descriptio

javascript - 暂停 youtube 视频,youtube api

我正在尝试使用以下代码暂停和播放YouTube视频,该代码几乎是YoutubeAPIpage的副本://2.ThiscodeloadstheIFramePlayerAPIcodeasynchronously.vartag=document.createElement('script');tag.src="http://www.youtube.com/player_api";varfirstScriptTag=document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag,firs

Javascript + MailChimp API 订阅

提出这个请求时://SubscribeanewaccountholdertoaMailChimplistfunctionsubscribeSomeoneToMailChimpList(){varoptions={"apikey":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","id":"xxxxxx","email":{"email":"me@example.com"},"send_welcome":false};varmcSubscribeRequest=UrlFetchApp.fetch("https://us4.api.mailchimp.com/2.0/li

javascript - jQuery $(document).ready() 在 IE6 中失败

我有以下代码://Createsatimertocheckforelementspoppingintothedomtimer=setInterval(function(){for(pinpixelTypes){checkElems(pixelTypes[p]);}},10);//AddDocumentfinishedcallback.$(document).ready(function(){//Documentisloaded,sostoptryingtofindnewpixelsclearInterval(timer);});在Firefox中,它工作得很好,但在IE6中,我在$(d

javascript - 如何在同一张 map 上使用带有多个标记的谷歌地图 API

因此,我有以下脚本来使用googlemapsAPI,一切正常,但我需要创建一个具有多个标记(指向某物的气球形图标)的map,并且我需要这些标记中的每一个要指向map的不同区域(即不同的坐标),我该怎么做?functionload(){varmap=newGMap2(document.getElementById("map"));varmarker=newGMarker(newGLatLng());varhtml=""+""+"";map.setCenter(newGLatLng(),)map.setMapType(G_HYBRID_MAP);map.addOverlay(marker)

javascript - 在 jquery.ready 之后加载 javascript 文件

我想在jquery.ready的末尾加载一个javascript文件,这样我就绪的处理程序中的代码就不必等到加载这个大的javascript文件后才执行。我的jquery.ready代码根本不依赖这个javascript文件。这是个好方法吗?$(function(){......$('head').append('');}); 最佳答案 使用.getScript:http://api.jquery.com/jQuery.getScript/$(document).ready(function(){......$.getScript(