473,729 Members | 2,097 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 3945
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
14693
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
15893
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
1743
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
1869
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
2118
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
3646
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
1281
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
2029
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
5260
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
8767
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,...
0
9428
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9293
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9221
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
8165
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...
0
4536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3246
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
3
2171
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.