gpt4 book ai didi

javascript - 有什么方法可以在 window.onload 中设置 google onload 回调吗?

转载 作者:行者123 更新时间:2023-12-02 20:13:56 24 4
gpt4 key购买 nike

这是我的代码:

window.onload = function(){
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(function(){
alert("Message");
});
}

有什么办法让这段代码工作吗?

最佳答案

Google 文档中的函数:

function loadMaps() {
google.load("maps", "2", {"callback" : mapsLoaded});
}

它似乎有回调对象,你可以在这里分配任何你喜欢的函数。

谷歌说:

You can load the Google API loader dynamically by creating a script element and setting its source to the same "https://www.google.com/jsapi?INSERT-YOUR-KEY" URL with an additional query callback parameter. The callback will be executed when the loader is ready.

关于javascript - 有什么方法可以在 window.onload 中设置 google onload 回调吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6592934/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com