473,671 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing onmouseover dymnamically

Hello,

I'm trying to change the onmouseover event dynamically.

This sets-up the initial onmouseover event:

<a href="home.html "> <img border="0" id="img22"
src="images/home1.jpg" height="15" width="85" alt="Home"
onmouseover="FP _swapImg(1,0,/*id*/'img22',/*url*/'images/home2.jpg')"</a>

Here I'm changing the image and trying to disable the onmouseover
event:

<script type="text/javascript">
if (bHome==0) {
FP_swapImg(1,0,/*id*/'img22',/*url*/'images/contact1.jpg');
document.write ('<div id="img22" onmouseover=""> <\/div>');
}
</script>

This script works with Mozilla but not with IE.
Any recommendations or suggestions?

Thanks for your help,
Richard

Jan 9 '06 #1
3 3941
dr*****@swbell. net said the following on 1/8/2006 11:23 PM:
Hello,

I'm trying to change the onmouseover event dynamically.

This sets-up the initial onmouseover event:

<a href="home.html "> <img border="0" id="img22"
src="images/home1.jpg" height="15" width="85" alt="Home"
onmouseover="FP _swapImg(1,0,/*id*/'img22',/*url*/'images/home2.jpg')"</a>


Is FP_swapImg a Front Page generated function?

If all you are wanting to do is change the onmouseover then reset it:

onmouseover="th is.src='images/home2.jpg';this .onmouseover=nu ll"

If you are intent on using the FP function then you have the id of the
image, you can set its onmouseover to null there:

function FP_swapImg(p1,p 2,imageID,image NewSrc){
//existing code
document.getEle mentById(imageI D).onmouseover = null;
}
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 9 '06 #2
On Sun, 08 Jan 2006 23:38:44 -0500, Randy Webb
<Hi************ @aol.com> wrote:
dr*****@swbell .net said the following on 1/8/2006 11:23 PM:
Hello,

I'm trying to change the onmouseover event dynamically.

This sets-up the initial onmouseover event:

<a href="home.html "> <img border="0" id="img22"
src="images/home1.jpg" height="15" width="85" alt="Home"
onmouseover="FP _swapImg(1,0,/*id*/'img22',/*url*/'images/home2.jpg')"</a>


Is FP_swapImg a Front Page generated function?

If all you are wanting to do is change the onmouseover then reset it:

onmouseover="t his.src='images/home2.jpg';this .onmouseover=nu ll"

If you are intent on using the FP function then you have the id of the
image, you can set its onmouseover to null there:

function FP_swapImg(p1,p 2,imageID,image NewSrc){
//existing code
document.getEl ementById(image ID).onmouseover = null;
}


Thanks for the info. It did the trick.

I uses this line for IE to work correctly:
document.getEle mentById(imageI D).onmouseover = null;

And used this line for Mozilla to work to correctly:
document.write ('<div id="imageID" onmouseover=nul l>');

I'm not sure why. Differences in the browsers I presume. But I've got
it working now.

Does anyone have any recommendations on good documentation (web sites,
books, etc.) that discribes the document and object properties. I
spend a lot of time trying to find a particular property for an object
or document. I've got a few properties figured out, but a good
document sure would be nice.

Have a good nite,
Richard

Jan 12 '06 #3
dr*****@swbell. net said the following on 1/11/2006 10:40 PM:
On Sun, 08 Jan 2006 23:38:44 -0500, Randy Webb
<Hi************ @aol.com> wrote:

dr*****@swbel l.net said the following on 1/8/2006 11:23 PM:
Hello,

I'm trying to change the onmouseover event dynamically.

This sets-up the initial onmouseover event:

<a href="home.html "> <img border="0" id="img22"
src="image s/home1.jpg" height="15" width="85" alt="Home"
onmouseover= "FP_swapImg(1,0 ,/*id*/'img22',/*url*/'images/home2.jpg')"</a>
Is FP_swapImg a Front Page generated function?

If all you are wanting to do is change the onmouseover then reset it:

onmouseover=" this.src='image s/home2.jpg';this .onmouseover=nu ll"

If you are intent on using the FP function then you have the id of the
image, you can set its onmouseover to null there:

function FP_swapImg(p1,p 2,imageID,image NewSrc){
//existing code
document.getE lementById(imag eID).onmouseove r = null;
}

Thanks for the info. It did the trick.

I uses this line for IE to work correctly:
document.getEle mentById(imageI D).onmouseover = null;

And used this line for Mozilla to work to correctly:
document.write ('<div id="imageID" onmouseover=nul l>');


How are you determining whether it is Mozilla or IE? I hope it's not via
the userAgent string? The first should work in both IE and Mozilla and
testing shows that it does so there is no need to try to figure out the
browser.

Also, using document.write after the page loads is a disaster in the
making as it wipes out the current page and replaces it with the new
content.
I'm not sure why. Differences in the browsers I presume. But I've got
it working now.

Does anyone have any recommendations on good documentation (web sites,
books, etc.) that discribes the document and object properties. I
spend a lot of time trying to find a particular property for an object
or document. I've got a few properties figured out, but a good
document sure would be nice.


To date, the best documentation I have found are the browsers
themselves. The archives for this group is also a good place to research.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Jan 12 '06 #4

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

Similar topics

3
14684
by: NeoPhreak | last post by:
I am creating a menu for my site and I would like it so that when the onMouseOut even is triggered it will cause the cell of the table to fade out back to the normal color with a delay. Can anyone help me to get started on how i would accomplish this?
6
15884
by: Carla | last post by:
hi people, I have a little problem that I can't solve with css and i was wondering if you could help me. I have 4 links, I want that when I click/mouseover in the link 1, it turns to a color a, then when I click/mouseover over the link 2, it turns to a color b and the link 1 turns to the normal link color again. (an so with the other links). Is this possible with CSS?
2
1727
by: Dominic Myers | last post by:
Hi there, wondered if someone could point me to an appropriate tutorial or offer advice on the following problem? I've got a web page which uses lots of divs to position the content of the page and I'm using a nice javascript to alter the css of a table of links. The thing is I don't want the table of links to point to an external site but to calla function which will replace the content of a layer... perhaps it's be better if I...
13
1858
by: mike | last post by:
I have some elements that I want to change color when I mouse over them and them back on mouse off. I'd like the color to remain with "#c7d0e0" when the user clicks on them. <td style="cursor:hand;" onMouseOver="this.style.background='#c7d0e0';" onMouseOut="this.style.background='#ffffff';" onClick="chg_the_color();">
12
2108
by: Nico Schuyt | last post by:
Maybe a stupid question (I'm not so familiar with javascript), but: I want to change background of a paragraph or list item on mouseover. The following code works: <p onMouseover="this.style.backgroundColor='yellow'" onMouseout="this.style.backgroundColor='white'">ppppp</p> Now I want to minimize the coding bij using a function. How do I do that?
7
3640
by: petethebloke | last post by:
Can anyone help? I have a client who has made a "dynamic interactive map" of our city using Dreamweaver. Each map file has hotspots that pop-up a div with a little image when the mouse goes over them. They also link to another file. I've converting the application to a PHP-AJAX system at http://www.ilex-urc-maps.com/testing.html but I can't get the dynamically altered hotspots to work. Any ideas? Please don't tell me that the client...
3
1280
by: Wojtek | last post by:
I have the following: <tr onMouseOver="alert('Over a row')"> and I want to modify the event to be: <tr onMouseOver="alert('Over THIS row')"> in other words reaching into the event, and changing some part of it.
3
2027
by: isoquin | last post by:
I'm working with the following code, trying to change the color of the links inside the divs. While the background color and border change exactly as they're supposed to, the text/link color itself doesn't. This is starting to drive me bonkers. Ideas please? <div class="style1">Gallery <div class="style2"> <table cellpadding="5" width="50" style="font-size:11px;" class="style3"> <tr><td...
5
5246
by: jeddiki | last post by:
I want to change the default background color of my select box. Here is the problem: Link to form with color select Notice in the color selector, the background color that I have given it it the option statement changes on hover to a blue/gray. Instead of background color change I would like the text to BOLD. So on hovering over green, the text "green" goes green (bold) but
0
8397
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8599
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6230
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4409
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2813
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2052
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.