onMouseOver and onClick event glitches

Posted on 1997-09-07
Medium Priority
Last Modified: 2011-10-03
I'm using the following script to enable image flipping on six buttons. When VAR SIZE = 1, image #1 works properly, but none of the others work correctly at any value. All suggestions will be greatly appreciated.


     var browser = navigator.appName.substring(0,8);
     var version = parseInt(navigator.appVersion);
     var javasupport = ((browser == "Netscape") && (version >= 3)) ||
     ((browser == "Microsoft") && (version >= 4));

     if (javasupport) {
     var normal = new makeArray(10);
     var hilite = new makeArray(10);
     var glow = new makeArray(10);
     var size = 1;

     hilite[1].src = "2_2graf.jpg"
     hilite[2].src = "2_3graf.jpg"
     hilite[3].src = "2_4graf.jpg"
     hilite[4].src = "3_2graf.jpg"
     hilite[5].src = "3_3graf.jpg"
     hilite[6].src = "3_4graf.jpg"

     normal[1].src = "2_2a.jpg"
     normal[2].src = "2_3a.jpg"
     normal[3].src = "2_4a.jpg"
     normal[4].src = "3_2a.jpg"
     normal[5].src = "3_3a.jpg"
     normal[6].src = "3_4a.jpg"

     glow[1].src = "2_2glow.jpg"
     glow[2].src = "2_3glow.jpg"
     glow[3].src = "2_4glow.jpg"
     glow[4].src = "3_2glow.jpg"
     glow[5].src = "3_3glow.jpg"
     glow[6].src = "3_4glow.jpg"


     function makeArray(n) {
     this.length = n
     for (var i = 1; i<=n; i++) {
     this[i] = new Image()
     return this

     function onImage(num) {
     if (javasupport) {
     document.images[num + size].src = hilite[num].src;

     function offImage(num) {
     if (javasupport) {
     document.images[num + size].src = normal[num].src;

     function onGlow (num) {
     if (javasupport) {
     document.images[num + size].src = glow[num].src;

     // -->




     HEIGHT=55 BORDER=0></TD>
     <TD WIDTH=45 HEIGHT=277 ROWSPAN=2><IMG SRC="2-3_1.jpg"
     BORDER=0 HEIGHT=277 WIDTH=45></TD>

     <TD WIDTH=146 HEIGHT=131>
     <A HREF="about.htm" onMouseOver="onImage(1)"
     onMouseOut="offImage(1)" onClick="onGlow(1)">
     <IMG SRC="2_2a.jpg" BORDER=0 HEIGHT=131

     <TD WIDTH=152 HEIGHT=131>
     <A HREF="services.htm" onMouseOver="onImage(2)"
     onMouseOut="offImage(2)" onClick="onGlow(2)">
     <IMG SRC="2_3a.jpg" BORDER=0 HEIGHT=131 WIDTH=152></TD>

     <TD WIDTH=145 HEIGHT=131>
     <A HREF="equip.htm" onMouseOver="onImage(3)"
     onMouseOut="offImage(3)" onClick="onGlow(3)">
     <IMG SRC="2_4a.jpg" BORDER=0 HEIGHT=131 WIDTH=145></TD>

     <TD WIDTH=152 HEIGHT=277 ROWSPAN=2><IMG SRC="2-3_5.jpg"
     BORDER=0 HEIGHT=277 WIDTH=152></TD>
     <TD WIDTH=146 HEIGHT=146>
     <A HREF="empops.htm" onMouseOver="onImage(4)"
     onMouseOut="offImage(4)" onClick="onGlow(4)">
     <IMG SRC="3_2a.jpg" BORDER=0 HEIGHT=146

     <TD WIDTH=152 HEIGHT=146>
     <A HREF="ref.htm" onMouseOver="onImage(5)"
     onMouseOut="offImage(5)" onClick="onGlow(5)">
     <IMG SRC="3_3a.jpg" BORDER=0 HEIGHT=146 WIDTH=152></TD>

     <TD WIDTH=145 HEIGHT=146><A HREF="app.htm"
     onMouseOver="onImage(6)" onMouseOut="offImage(6)"
     <IMG SRC="3_4a.jpg" BORDER=0 HEIGHT=146 WIDTH=145></TD>
     <TD WIDTH=640 HEIGHT=148 COLSPAN=5><IMG SRC="r4.jpg"
     WIDTH=640 HEIGHT=148 BORDER=0></TD>
Question by:rc090797
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 10

Accepted Solution

kollegov earned 100 total points
ID: 1269974
Problem in table. Netscape not always work correctly with
images placed in tables.
1. Try to remove table
and check would your script work or not.
(hope it will)
2. check your table and corresponding image sizes.
probably your images do not fit in predefined table
3. If you have this document on-line
drop me URL and I'll try to solve this puzzle.
(you are not first one who have such problems)
Give me some time and URL and I'll give you your html
back with corrected problems.

Author Comment

ID: 1269975
This answer is a great idea, but not the problem solver. The table is necessary for the images to combine seamlessly to create one image.

I can't give you the URL, but I can tell you that the color coding that my html editor uses for different types of tags, changes at the last two functions statements of this script. This would indicate that the problem is not in the html itself, but in the script and how I've set the variables or defined the images. I need to know what error I've made in this area and was hoping the answer would be easily identified by someone more aquainted with JavaScript than I. I'm only able to hack a script.




Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question