Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. onmouseorver for child element

onmouseorver for child element

Scheduled Pinned Locked Moved JavaScript
javascripthelp
2 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    greendragons
    wrote on last edited by
    #1

    i was creating little animation using javascript....but got stuck body{} .imgC{width:350px; height:300px;} #divV{background-color:#000000; opacity:0.6; filter:alpha(opacity=60); width:350px; height:70px;} #mainDiv{width:100%; height:100%; background-color:#c3c3c3; top:0px; left:0px; position:absolute;} window.onload=inItAll; function inItAll() { document.getElementById("img1").onmouseover = cursorOver; document.getElementById("img1").onmouseout = cursorOut; document.getElementById("divV").onmouseout = cursorVOut; } function cursorOver() { if(!document.getElementById("divV")) { var Y1 = document.getElementById("img1").offsetTop; var X1 = document.getElementById("img1").offsetLeft; var Elem = document.createElement("div"); Elem.id="divV"; Elem.cssClass="divVc"; Elem.style.position="absolute"; Elem.style.top = 230+Y1+"px"; Elem.style.left = X1+"px"; document.getElementById("div1").appendChild(Elem); } } function cursorOut(e) { var Y1 = document.getElementById("img1").offsetTop; var Y2 = Y1 + 300; var X1 = document.getElementById("img1").offsetLeft; var X2 = X1 + 350; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX posy = e.clientY } if(posx>=X1 && posx<=X2 && posy>=Y1 && posy<=Y2) { } else { var Elem = document.getElementById("divV"); document.getElementById("div1").removeChild(Elem); } } function cursorVOut() { var Elem = document.getElementById("divV"); document.getElementById("div1").removeChild(Elem); } ![](images/1.jpg) everything works fine except document.getElementById("divV").onmouseout = cursorVOut; this part is not working..... when i bring cursor on image(img1) a small div appears at the bottom of image and if i move my cursor out it should disappear...the p

    N 1 Reply Last reply
    0
    • G greendragons

      i was creating little animation using javascript....but got stuck body{} .imgC{width:350px; height:300px;} #divV{background-color:#000000; opacity:0.6; filter:alpha(opacity=60); width:350px; height:70px;} #mainDiv{width:100%; height:100%; background-color:#c3c3c3; top:0px; left:0px; position:absolute;} window.onload=inItAll; function inItAll() { document.getElementById("img1").onmouseover = cursorOver; document.getElementById("img1").onmouseout = cursorOut; document.getElementById("divV").onmouseout = cursorVOut; } function cursorOver() { if(!document.getElementById("divV")) { var Y1 = document.getElementById("img1").offsetTop; var X1 = document.getElementById("img1").offsetLeft; var Elem = document.createElement("div"); Elem.id="divV"; Elem.cssClass="divVc"; Elem.style.position="absolute"; Elem.style.top = 230+Y1+"px"; Elem.style.left = X1+"px"; document.getElementById("div1").appendChild(Elem); } } function cursorOut(e) { var Y1 = document.getElementById("img1").offsetTop; var Y2 = Y1 + 300; var X1 = document.getElementById("img1").offsetLeft; var X2 = X1 + 350; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX posy = e.clientY } if(posx>=X1 && posx<=X2 && posy>=Y1 && posy<=Y2) { } else { var Elem = document.getElementById("divV"); document.getElementById("div1").removeChild(Elem); } } function cursorVOut() { var Elem = document.getElementById("divV"); document.getElementById("div1").removeChild(Elem); } ![](images/1.jpg) everything works fine except document.getElementById("divV").onmouseout = cursorVOut; this part is not working..... when i bring cursor on image(img1) a small div appears at the bottom of image and if i move my cursor out it should disappear...the p

      N Offline
      N Offline
      NeverHeardOfMe
      wrote on last edited by
      #2

      Personally I can't see how any of it works. Your onload function refers to divV before it has even been defined. Can I suggest you try using the Error console in Firefox to try debugging your JavaScript....

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups