I had problem with onmouse out in div

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Jun 2009
Posts: 8
Reputation: mvchandoo is an unknown quantity at this point 
Solved Threads: 1
mvchandoo mvchandoo is offline Offline
Newbie Poster

I had problem with onmouse out in div

 
0
  #1
Sep 9th, 2009
I had problem with mouse out in div. i tried for one long day in vain. can any one do it. it was an urgent issue.Thank you in advance.
the code is
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>The test</title>
</head>
<script type="text/javascript">
function changeStyle(div)
{

document.getElementById(div).innerHTML='<a href="index.php?id=1"><img alt="Eon Beats" src="../cmsfiles/artist/3/EonBeats_web.jpg"/></a>';
}

function changeStyleBack(div)
{
//alert('no hover')
document.getElementById(div).innerHTML='<a href="index.php?id=1"><img alt="Eon Beats" src="../cmsfiles/artist/2/Michelle Martinez cropped.jpg"/></a>';
}
</script>
<!--<style type="text/css">
.home a:hover{
background-color:#000000;
background-image:none;
}
</style>-->
<body>
<table border="0" width="400" cellspacing="1" cellpadding="5" align="center">
<tr>

<td>
<div id="im_1" onmouseover="changeStyle('im_1')" onmouseout="changeStyleBack('im_1')">
<a href="index.php?id=2">
<img src='../cmsfiles/artist/2/Michelle Martinez cropped.jpg' alt='The Groove Academy'></a></div>
</td>
<td>
<div id="im_2" onmouseover="changeStyle('im_2')" onmouseout="changeStyleBack('im_2')">
<a href="index.php?id=3">
<img src='../cmsfiles/artist/3/EonBeats_web.jpg' alt='Eon Beats'></a></div>
</td>
<td>
<div id="im_3" onmouseover="changeStyle('im_3')" onmouseout="changeStyleBack('im_3')">
<a href="index.php?id=4">
<img src='../cmsfiles/artist/4/Boogaloo Anita-1.jpg' alt='Boogaloo Crew'></a></div>
</td>
<td>
<div id="im_4" onmouseover="changeStyle('im_4')" onmouseout="changeStyleBack('im_4')">

<a href="index.php?id=5">
<img src='../cmsfiles/artist/5/ReelSessions_web.jpg' alt='Reel Sessions'></a></div>
</td>
</tr>
<td>
<div id="im_5" onmouseover="changeStyle('im_5')" onmouseout="changeStyleBack('im_5')">
<a href="index.php?id=6">
<img src='../cmsfiles/artist/6/FowlPlay_web.jpg' alt='Fowl Play'></a></div>
</td>
<td>
<div id="im_6" onmouseover="changeStyle('im_6')" onmouseout="changeStyleBack('im_6')">
<a href="index.php?id=22">
<img src='../cmsfiles/artist/22/Dirty Hendrix_web.jpg' alt='Dirty Hendrix'></a></div>
</td>
<td>
<div id="im_7" onmouseover="changeStyle('im_7')" onmouseout="changeStyleBack('im_7')">

<a href="index.php?id=40">
<img src='../cmsfiles/artist/40/flatwound.jpg' alt='Flatwound'></a></div>
</td>
</tr>
</table>
</body>
</html>
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 318
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: I had problem with onmouse out in div

 
0
  #2
Sep 9th, 2009
Can u give an explanation of what the problem is?

I have tried this, and on the onmouseover event, the innerhtml is changed. I had removed the images and just places text since i dont have the images.
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 40
Reputation: beeerlover is an unknown quantity at this point 
Solved Threads: 6
beeerlover's Avatar
beeerlover beeerlover is offline Offline
Light Poster

Re: I had problem with onmouse out in div

 
0
  #3
Sep 9th, 2009
There might be other problems but at first glance I notice {your old code}:
  1. <!--<style type="text/css">
  2. .home a:hover{
  3. background-color:#000000;
  4. background-image:none;
  5. }
  6. </style>-->
It looks to me like you are commenting out the style tag, telling the browser to ignore it. I think it should be {your new code}:
  1. <style type="text/css"><!--
  2. .home a:hover{
  3. background-color:#000000;
  4. background-image:none;
  5. }
  6. --></style>

Hope that does the trick. Gotta luv how daniweb's code highlighting automatically shows where the problem is in your code by the black color
www.bestbridalprices.com <- my job with 15K+ Wedding Dresses
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 348
Reputation: Troy III will become famous soon enough Troy III will become famous soon enough 
Solved Threads: 42
Troy III's Avatar
Troy III Troy III is offline Offline
Posting Whiz

Re: I had problem with onmouse out in div

 
0
  #4
Sep 9th, 2009
Originally Posted by mvchandoo View Post
I had problem with mouse out in div. i tried for one long day in vain. can any one do it. it was an urgent issue.Thank you in advance.
the code is...
That's because you are creating a situation of infinite "mouseover" event occurrence.
Last edited by Troy III; Sep 9th, 2009 at 11:24 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 8
Reputation: mvchandoo is an unknown quantity at this point 
Solved Threads: 1
mvchandoo mvchandoo is offline Offline
Newbie Poster

Re: I had problem with onmouse out in div

 
0
  #5
Sep 10th, 2009
Hi Thanks to all
My problem is when onmouseover the image is changing but after mouseout image have to return to its backstage. but it is not returning to backstage. the onmouseover event image is setting up.
however
I resolved the problem by setting up the onmouseover events to anchor tag.
Thankyou
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 348
Reputation: Troy III will become famous soon enough Troy III will become famous soon enough 
Solved Threads: 42
Troy III's Avatar
Troy III Troy III is offline Offline
Posting Whiz

Re: I had problem with onmouse out in div

 
0
  #6
Sep 10th, 2009
Originally Posted by mvchandoo View Post
Hi Thanks to all
My problem is when onmouseover the image is changing but after mouseout image have to return to its backstage. but it is not returning to backstage. the onmouseover event image is setting up.
however
I resolved the problem by setting up the onmouseover events to anchor tag.
Thankyou
Yes that should break the recursive mouseover rising event, but what about second mouseover? That is: after the mouseout event has taken place? It will most probably die. Of course if you don't write the event handler along with the innerHTML of the element you've changed, that is.
Reply With Quote Quick reply to this message  
Reply

Tags
onmouseoutdivproblem

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 553 | Replies: 5
Thread Tools Search this Thread



Tag cloud for onmouseoutdivproblem
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC