yaragallamurali Posted October 10, 2013 Share Posted October 10, 2013 Hi before adding <!DOCTYPE html > to my html, my javascript code is working fine. But by adding this to my html, the below part of the code is not working div.style.left=x;div.style.top=y; i am not able to set left and top values to an element. What could be the problem? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 10, 2013 Share Posted October 10, 2013 There's not enough code there to suggest anything. Do you have a link to the page online? Have you checked for Javascript errors? Link to comment Share on other sites More sharing options...
Ingolme Posted October 10, 2013 Share Posted October 10, 2013 The reason is that you forgot to specify that the position is in pixels: div.style.left=x + "px";div.style.top=y + "px"; Link to comment Share on other sites More sharing options...
yaragallamurali Posted October 10, 2013 Author Share Posted October 10, 2013 ya i found the mistake. Thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now