问题描述
在编写JavaScript和Ajax时,这个函数没有适当的文档。我用 api src =http://www.google.com/jsapi
和 searchControl.execute(abhilashm86)搜索了这个词。
。 这是如何在内部调用 google.setOnLoadCallback(initialize)
?当用户清除之前的搜索并启动一个新的搜索项时,该功能是否仅用于新的搜索项?
google.setOnLoadCallback(initialize)
如何得到trigerred?
当您的文档(包括Google API)被完全加载时,您的初始化函数将被调用。因此,您应该在您传递的函数中包装使用API的任何代码:
google.setOnLoadCallback(function()
{
var searcher = new google.search.SearchControl( );
//更多的代码依赖于API
});
While coding JavaScript and Ajax, there is no proper documentation for this function. I searched this term using api src="http://www.google.com/jsapi"
and searchControl.execute("abhilashm86");
.
How is this google.setOnLoadCallback(initialize)
called internally? Is this function just for a new search term when the user clears previous search and starts a new one?How exactly does google.setOnLoadCallback(initialize)
get trigerred?
Your initialize function will be called when your document (including the Google API) is fully loaded. So you should wrap any code that uses the API in the function you pass in:
E.g.
google.setOnLoadCallback(function()
{
var searcher = new google.search.SearchControl();
// More code that depends on the API.
});
这篇关于google.setOnLoadCallback(初始化)函数究竟意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!