473,378 Members | 1,523 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,378 software developers and data experts.

Onmouseout will not change permanently

3
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 (2) set the clicked button's onmouseout to stay highlighted. When I run it, the src goes back normally, but the onmouseout doesn't seem to change.

Expand|Select|Wrap|Line Numbers
  1. function findCol(a)
  2. {
  3.     var elems=document.getElementsByTagName("*");
  4.     var name,index;
  5.     for(var i=0;i<elems.length;i++)
  6.     {
  7.         name=elems[i].id;
  8.         if(name!="")
  9.         {
  10.             if(name.indexOf("head-")>-1)
  11.             {
  12.                 var src=elems[i].src.toString();
  13.                 var mouseout=elems[i].onmouseout.toString();
  14.                 src=src.replace(/03.gif/,"01.gif");
  15.                 mouseout=mouseout.replace(/03.gif/,"01.gif");
  16.                 elems[i].src=src;
  17.                 elems[i].onmouseout=mouseout;
  18.             }
  19.             if(name.indexOf("head-"+a+"-")>-1)
  20.             {
  21.                 var mouseout=elems[i].onmouseout.toString();
  22.                 if(mouseout.indexOf("01.gif")>-1)
  23.                 {mouseout=mouseout.replace(/01.gif/,"03.gif");}
  24.                 else{mouseout=mouseout.replace(/03.gif/,"01.gif");}
  25.                 elems[i].onmouseout=mouseout;
  26.             }
  27.         }
  28.     }
  29. }
  30.  
Apr 27 '07 #1
2 1312
iam_clint
1,208 Expert 1GB
changing mouse functions on an element using dom isn't pretty


obj.onmouseout = function () { dowhatever }
Apr 27 '07 #2
pbmods
5,821 Expert 4TB
Try using removeEventListener (or in IE, it's called detachEvent for some reason):

http://developer.mozilla.org/en/docs...eEventListener
Apr 28 '07 #3

Sign in to post your reply or Sign up for a free account.

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...
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...
0
by: kieran | last post by:
Hi, I was using the datagrid and am now starting to use the gridview in asp.net 2.0. I used to use the first below sub for when i would mouseover a row - this highlighted the row but did not...
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\"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.