Click here to Skip to main content
14,638,971 members
Rate this:
Please Sign up or sign in to vote.
See more:
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" />

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.
Posted
Updated 10-Dec-14 8:52am
v9
Comments
Richard MacCutchan 10-Dec-14 12:13pm
   
How can this bug be solved?
Probably by correcting the errors in your code. However you need to provide some more details for people to help.
s yu 10-Dec-14 12:52pm
   
Thanks. See my updated post content.
Richard Deeming 10-Dec-14 13:57pm
   
You haven't shown any of the code that calls those functions.
s yu 10-Dec-14 14:53pm
   
The code was filtered out somehow. Let me post here:
<div id="div_ImgBtn" class="divButton" style="left: 84px;">
<input id="btn_ImgMap" type="button" name="Street" value="Imagery" class="tabButton" />
</div>
s yu 10-Dec-14 14:54pm
   
also got filtered out some of the content, like: onkeypress="btn_ToggleMap_OnClick('1');" onmouseover="myTooltip.show('Image Basemap', 200, 3);"

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

var myTooltip = function () { ... }

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.
   
Comments
s yu 10-Dec-14 14:56pm
   
Richard Deeming is right.
Richard MacCutchan 11-Dec-14 3:56am
   
I looked all through the w3schools pages to see if that was possible, but found no reference to anonymous functions.
Richard MacCutchan 11-Dec-14 3:57am
   
The javascript that you posted did not actually show where you called that function, but since you have deleted it it is no longer clear what your code is doing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100