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

HTML div related problem

hi guys, i want to call a fucntion on the onmouseout event whenever i get out of the outer div, but even when i try to move my mouse from one inner div to another the fuction gets called. i want the function should only get called when i move my mouse out side the outerdiv,,, please solve my problem..ASAP

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <title>New Page 1</title>
  6. <script>
  7. var funval;
  8. function setfun()
  9. {
  10.     funval=2;
  11. }
  12. function getfun()
  13. {
  14.     alert(funval);
  15. }
  16. </script>
  17. </head>
  18.  
  19. <body>
  20. <table>
  21. <tr>
  22. <td>
  23.  
  24. <div style="bgcolor=red;cursor:hand" onmouseout="getfun();">
  25. <table>
  26. <tr>
  27. <td>
  28. <div><img src="../../All%20Users/Documents/My%20Pictures/Sample%20Pictures/Sunset.jpg"  ></div>
  29. </td>
  30. </tr>
  31. <tr>
  32. <td>
  33. <div><img src="../../All%20Users/Documents/My%20Pictures/Sample%20Pictures/Water%20lilies.jpg" onmouseover="setfun();"></div>
  34. </td>
  35. </tr>
  36. <tr>
  37. <td>
  38. <div><img src="../../All%20Users/Documents/My%20Pictures/Sample%20Pictures/Winter.jpg"></div>
  39. </td>
  40. </tr>
  41. </table>
  42.  
  43. </div>
  44. </td>
  45. </tr>
  46. </table>
  47.  
  48. </body>
  49.  
  50. </html>
Nov 21 '08 #1
2 1668
serdar
88
Your problem is caused by 'event bubbling'. Read this article.
Nov 21 '08 #2
clain
79
the outer div is the parent of inner div... in the sense.. whatever you do inside inner div is also effect the outer div events cos its already an event of outer div by position.
Dec 1 '08 #3

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

Similar topics

13
by: Phil Powell | last post by:
I am having a potential PHP/Javascript/HTML conflict going on in my code that I simply can't resolve - been wracking my brain for a good hour over this one and have come up with no good solution. ...
34
by: Niels Berkers | last post by:
Hi, i'd like to host my web pages using multiparts to reduce the number of hits on the server. i know this isn't a real PHP subject, but i'll try it anyway. i've been searching the web for...
6
by: Gaurav | last post by:
Hello, i have some java script with in html. It runs fine on IE 6.0 but doesnt run on some browsers like IE 5.0. Can someone tell me whats the problem ? And how can i solve it. here is the...
71
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's...
5
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
4
by: J Huntley Palmer | last post by:
How may I setup a proper HTML mail message with embedded href links using PHP, that follows all the MIME rules? Any examples or links would be appreciated. Thanks!
9
by: Tony Girgenti | last post by:
Hello. I'm developing and testing a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 computer. I'm using a web form. For a...
10
by: Roderik | last post by:
Hi, This is a folluw-up from the html group because it was considered off-topic there. I am wondering why (half of the) squared images are not aligned on the right of the text in Internet...
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.