JavaScript - 函数调用 [英] JavaScript - Function calls

查看:88
本文介绍了JavaScript - 函数调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在处理的这个应用程序中,有2个文件:

1).html文件,其中包含JavaScript代码;

2).js文件包含多个函数。

在.html文件中,有一行来引用.js文件。

在我的实现中,.js中的一些函数可以被正确调用,但其中一些返回'未定义',这意味着函数调用无法访问引用的.js文件。

例如,在.html中,

In this application I am working on, there are 2 files:
1) .html file which contains the JavaScript code;
2) .js file which contains multiple functions.
In the .html file, there is a line to refer to the .js file.
In my implementation, some of the functions in the .js can be called properly, but some of them returns 'Not defined', which means the function call gets failure to access to the referenced .js file.
For instance, in the .html,

<input id="btn_ImgMap" type="button" name="Street" value="Imagery" class="tabButton" />



我在上述两个函数中都设置了断点用于调试。第一个功能正常工作,但第二个功能不起作用(实际上事件:onmouseover,onmouseout和onfocus未实现)。

如何解决这个bug?如果你能分享你的经验,请提前致谢。


I put breakpoints for debugging on both functions above. The 1st function works properly, but the 2nd one does not work ( actually the events: onmouseover, onmouseout and onfocus are not implemented).
How can this bug be solved? Thanks in advance if you can share your experience.

推荐答案

var myTooltip = function () { ... }



function 是一个javascript关键字,你不能以这种方式使用它,它没有任何意义。请参见 http://www.w3schools.com/js/js_functions.asp [ ^ ]了解详情。


function is a javascript keyword, you cannot use it in this way, it has no meaning. See http://www.w3schools.com/js/js_functions.asp[^] for full details.


这篇关于JavaScript - 函数调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆