问题描述
这是什么意思?
google.maps.event.addDomListener(window,'load',initialize);
我有函数'initialize()',但我还添加了两个参数,经度和纬度,像这样: 因为这样,我必须对行中的'initialize'做任何事情: 将DOM事件侦听器添加到 来自: What does this mean? I have the function 'initialize()' but I also added two paramters, longitude and latitude so it's like this: because of this do I have to do anything to the 'initialize' in the line: The google.maps.event.addDomListener adds a DOM event listener, in this case to the from the documentation: The 这篇关于什么是“google.maps.event.addDomListener(window,'load',initialize);”意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
$ p $ 函数初始化(经度,纬度){
}
code>
google.maps.event.addDomListener(window,'load',initialize);
窗口中
对象,用于'load'事件,并指定一个要运行的函数。
在
是一个函数指针,你不能传递参数接着就,随即。要传入参数,请将其包装在匿名函数(不带参数)中: google.maps.event.addDomListener(window,'load',initialize)中初始化
;
google.maps.event。 addDomListener(window,'load',function(){
initialize(latitude,longitude);
});
google.maps.event.addDomListener(window, 'load', initialize);
function initialize(longitude, latitude){
}
google.maps.event.addDomListener(window, 'load', initialize);
window
object, for the 'load' event, and specifies a function to run.initialize
in google.maps.event.addDomListener(window, 'load', initialize);
is a function pointer, you can't pass arguments with that. To pass in arguments, wrap it in an anonymous function (that doesn't take arguments):google.maps.event.addDomListener(window, 'load', function () {
initialize(latitude, longitude);
});