Stickybomb Posted March 26, 2007 Share Posted March 26, 2007 i am working on a script to make a div move around on the sceen when you mouse over an image for some reason i cant get it to work i think i have a DOM issue but not sure here is the code i am using. onmouseover="document.families-head.style.top='500px'; i have a similar out call that moves the div back. both of which are being from an image. if anyone could assist me with this it would help alot thks! Quote Link to comment Share on other sites More sharing options...
mainewoods Posted March 27, 2007 Share Posted March 27, 2007 What is 'families-head'? Is that the id= of the div? If so then do this: onmouseover="document.getElementById('families-head').style.top = '500px';" Quote Link to comment Share on other sites More sharing options...
BlackenedSky Posted March 28, 2007 Share Posted March 28, 2007 change the position of the element using element.style.top or element.style.left in firefox, but in IE use element.offsetTop and element.offsetLeft unless the element is positioned absolutely. no harm in using both to make sure Quote Link to comment Share on other sites More sharing options...
mainewoods Posted March 28, 2007 Share Posted March 28, 2007 in ie, you might want to leave off the 'px': onmouseover="document.getElementById('families-head').style.top = '500';" Quote Link to comment Share on other sites More sharing options...
BlackenedSky Posted March 29, 2007 Share Posted March 29, 2007 in ie, you might want to leave off the 'px': onmouseover="document.getElementById('families-head').style.top = '500';" or use: onmouseover="document.getElementById('families-head').style.top = 500 + 'px';" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.