Closed Bug 59605 Opened 24 years ago Closed 24 years ago

Mouse on with JavaScript

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED DUPLICATE of bug 56799

People

(Reporter: venur, Assigned: jst)

Details

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/4.5 [en] (WinNT; I)
BuildID:    2000080712

When I loaded the attached file an image will be displayed. as per netscape when 
mouse moves over the image text should appear on the image and text should 
disapper once mouse is off the image. but it is not happening instead an error 
message saying Event not defined appears in the Javascript console 

Reproducible: Always
Steps to Reproduce:
1.just load the attached file..
2.
3.

Actual Results:  Image is displayed , on mouse over the image nothing is 
happening and an error message Event not defined is displayed in the javascript 
console

Expected Results:  An image will be displayed. as per netscape when mouse moves 
over the image text should appear on the image and text should disapper once 
mouse is off the image.
Here is the HTML itself: 

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var maximages = 6; // how many fade images do you have?
var fadespeed = 125; // fade frame time in milliseconds;  125 = 125 ms

var fadeintimer;
var fadeouttimer;
var fadeincount = 0;
var fadeoutcount = maximages-1;
var fadearray = new Array(maximages);  // enter all the fade images here
// the first item should be 0, then numbered through 1 less than your maximages

fadearray[0] = "http://javascript.internet.com/img/fading-rollover/fade00.jpg";
fadearray[1] = "http://javascript.internet.com/img/fading-rollover/fade01.jpg";
fadearray[2] = "http://javascript.internet.com/img/fading-rollover/fade02.jpg";
fadearray[3] = "http://javascript.internet.com/img/fading-rollover/fade03.jpg";
fadearray[4] = "http://javascript.internet.com/img/fading-rollover/fade04.jpg";
fadearray[5] = "http://javascript.internet.com/img/fading-rollover/fade05.jpg";

for (var i = 0; i < maximages; i++) {
eval('pic' + i + ' = new Image();');
eval('pic' + i + '.src = fadearray[i];'); // preloads fade images
}


function fade_in() {
clearTimeout(fadeouttimer);
document.images['fade-pic'].src = fadearray[fadeincount];
if (fadeincount != maximages-1) {
fadeincount++;
fadeintimer = setTimeout('fade_in()', fadespeed);
}
else {
clearTimeout(fadeintimer);
fadeincount = 0;
   }
}


function fade_out() {
clearTimeout(fadeintimer);
document.images['fade-pic'].src = fadearray[fadeoutcount];
if (fadeoutcount != 0) {
fadeoutcount--;
fadeouttimer = setTimeout('fade_out()', fadespeed);
}
else {
clearTimeout(fadeouttimer);
fadeoutcount = maximages-1;
   }
}

//  End -->
</script>
</HEAD>
<body>
<BODY>

<center>
<a href="http://javascriptsource.com" onmouseover="fade_in()" 
onmouseout="fade_out()">
<img src="http://javascript.internet.com/img/fading-rollover/icontop.gif" 
border=0><br>
<img name="fade-pic" height=56 width=300 border=0 
src="http://javascript.internet.com/img/fading-rollover/fade00.jpg"><br>
<img src="http://javascript.internet.com/img/fading-rollover/iconbtm.gif" 
border=0><br></a>
</center>
</body>
</html>
Browser, not engine. Reassigning to DOM Level 0 component -



Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
I am getting these errors in the Mozilla JavaScript console:

                "Can't convert fadeintimer to an integer"
                "Can't convert fadeouttimer to an integer"



The functions clearTimeout(fadeintimer) and clearTimeout(fadeouttimer) 
are being called with fadeintimer or fadeouttimer uninitialized; 
that is, = undefined. NN4.7 used to allow this; N6/Mozilla does not. 


To see a simpler example, key in this in the URL bar in NN4.7 vs. N6/Mozilla:

                javascript: var x; clearTimeout(x)


IN NN4.7 you will get no error in the JavaScript console; in N6/Mozilla
you get the error

                "Can't convert x to an integer"


Resolving as duplicate of bug 56799 -

*** This bug has been marked as a duplicate of 56799 ***
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
VERIFIED dup
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: