473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

onmouseout not working

Does anyone know why the onmouseout isn't working in the following?
I've just started the script (tho I'm sure I've spent over 40hrs on
this problem alone) and am trying to get just 2 buttons working before
I add the other 4. I'm absolutely mystified by the sticky onmouseout.

I've combined a couple of scripts that I've found in the newsgroup to
accomodate the mouseovers and "active" button action. Only 1 button
can be active at a time.

If you need further info, let me know I'd be happy to furnish. Thanks
in advance for any advice/comments.
Matt
<html>
<head>
<script language="JavaScript">
<!--
var btnstate="down";
image01= new Image(42,42)
image01.src="new2_03.gif"
image02= new Image(42,42)
image02.src="new2_03-over.gif"
image03= new Image(42,42)
image03.src="new2_07.gif"
image04= new Image(42,42)
image04.src="new2_07-over.gif"

function rollover(imagename, newsrc){
document.images[imagename].src=newsrc.src
}

function setAllButtonsUp(btnstate){
//alert(btnstate);
document.example.src='new2_03-over.gif';
document.example2.src='new2_07.gif';
// document.upbutton3.src=new2_11.gif
// document.upbutton4.src=new2_13.gif
// document.upbutton5.src=new2_16.gif
// document.upbutton6.src=new2_19.gif
// document.upbutton7.src=new2_21.gif
}

function setAllButtonsUp2(btnstate){
//alert(btnstate);
document.example.src='new2_03.gif';
document.example2.src='new2_07-over.gif';
// document.upbutton3.src=new2_11.gif
// document.upbutton4.src=new2_13.gif
// document.upbutton5.src=new2_16.gif
// document.upbutton6.src=new2_19.gif
// document.upbutton7.src=new2_21.gif
}

//-->
</script>
</head>

<body>
<a href="#" onmouseover="rollover('example', image02)"
onmouseout="if(btnstate != down')rollover('example', image03)"

onclick="setAllButtonsUp('down');document.example. src='new2_03-over.gif';"><img
src="new2_03.gif" name="example">
</a>
<a href="#" onmouseover="rollover('example2', image04)"
onmouseout="if(btnstate != 'down')rollover('example2', image04)"

onclick="setAllButtonsUp2('up');document.example2. src='new2_07-over.gif';"><img
src="new2_07.gif" name="example2">
</a>
</body>

</html>
Jul 23 '05 #1
5 2389
Matt L. wrote:
Does anyone know why the onmouseout isn't working in the following? <snip>
var btnstate="down";
<snip>
onmouseout="if(btnstate != down')rollover('example', image03)"

I didn't see where btnstate was ever set to anything other than 'down'
so the mouseout event never called the rollover function. You'll
probably want to set it to something other than 'down' where
appropriate. If I initialize btnstate to 'up' at the beginning of the
javascript the following work on my ie6:

<a href="#" onMouseOut="if(btnstate!='down'){rollover('example 1',
image03)}"><img src="new2_03.gif" name="example"></a>
<a href="#" onMouseOut="if(btnstate!='down'){rollover('example 2',
image04)}"><img src="new2_03.gif" name="example"></a>

Mike
Jul 23 '05 #2
Lee
Matt L. said:

Does anyone know why the onmouseout isn't working in the following?
I've just started the script (tho I'm sure I've spent over 40hrs on
this problem alone) and am trying to get just 2 buttons working before
I add the other 4. I'm absolutely mystified by the sticky onmouseout. <a href="#" onmouseover="rollover('example', image02)"
onmouseout="if(btnstate != down')rollover('example', image03)"


That missing quote doesn't jump out at you?

Jul 23 '05 #3
Thanks for the tip. I apologize for the sloppy code.

(I've been staring at these lines for several days now trying figure this
out)

In exasperation I must have left it out in my post. Unfortunately, putting
it where it belongs doesn't fix the problem for me.

Do you see anything else that is wrong or out of place?

Appreciate the feedback,
Matt
"Lee" <RE**************@cox.net> wrote in message
news:ci*********@drn.newsguy.com...
Matt L. said:

Does anyone know why the onmouseout isn't working in the following?
I've just started the script (tho I'm sure I've spent over 40hrs on
this problem alone) and am trying to get just 2 buttons working before
I add the other 4. I'm absolutely mystified by the sticky onmouseout.

<a href="#" onmouseover="rollover('example', image02)"
onmouseout="if(btnstate != down')rollover('example', image03)"


That missing quote doesn't jump out at you?

Jul 23 '05 #4
Matt L. wrote:
<snip>
In exasperation I must have left it out in my post. Unfortunately, putting
it where it belongs doesn't fix the problem for me.
Do you see anything else that is wrong or out of place?


Please post all of your code.
Mike
Jul 23 '05 #5
Mike-
See your email....

Matt
"mscir" <ms***@access4less.net> wrote in message
news:10************@corp.supernews.com...
Matt L. wrote:
<snip>
In exasperation I must have left it out in my post. Unfortunately, putting it where it belongs doesn't fix the problem for me.
Do you see anything else that is wrong or out of place?


Please post all of your code.
Mike

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Roy G. Vervoort | last post by:
Is it possible to put several commands in the onmouseout command I'm having several links each with its own ID (roll1, roll2, roll3, etc) and i would like all to change on the OnMouseOver command...
12
by: Epetruk | last post by:
Hi all, I want a page where the contents of a table cell are replaced with an image when the mouse moves over the cell, and the text is restored when the mouse moves out. Here's the html for the...
5
by: 50295 | last post by:
Hi! Javascript is doing something funny here. I expect that the onmouseout handler "leave" should be called only when the mosuse has left the entire list UL, but its triggered everytime, I move...
4
by: Gary | last post by:
Can somebody help me get the onMouseOut to work in this script? The onMouseOver works great opening a new window with an image, but I'd like to get the popup window to close onMouseOut. Is this...
3
by: Rob Roberts | last post by:
I'm using .NET 2.0 and C# on a web site, and I'm trying to use the onmouseover and onmouseout events to do a rollover effect on an asp.net button. I've tried manually adding the events to the...
2
by: Steve Macleod | last post by:
Hi, I was wondering if anyone would be good enough to have a look at the following code and tell me if there is something im missing! drug_list is an array of drug details table is a reference to...
2
by: Daz | last post by:
Hi everyone. I think my problem is a simple one, but I am completely baffled as to how to pull it off. I have a piece of code like so... document.write( "<img id=\"slideshow_toggle\"...
2
by: mevima | last post by:
I have a series of buttons across the top of a page, and a function called onclick which is supposed to (1) reset all the onmouseouts of the other buttons, so that they go back to normal, and then...
7
by: fsalvador | last post by:
Hi, I am trying to figure it out how to to hide in onmouseout the select options of a form. Below is the code I got so far. It isn't working. Please help. Thanks <!DOCTYPE HTML PUBLIC...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.