Hello everyone, guys
I've been having some trouble with styling an element in my page. Can any of u see the problem?
I have tryed to alert the methods _getX() and _getY(), and both functions are working pretty. I think the problem it's on the styling thing, or getting the element on the page.HTML Code:<html> <head> <script type="text/javascript"> function Window() { this._getY = function() { return(window.innerHeight); } this._getX = function() { return(window.innerWidth); } this._load = function() { var w = document.getElementById("window"); w.style.width = this._getX(); w.style.height = this._getY(); } } var WINDOW = new Window(); WINDOW._load(); </script> <style type="text/css"> #window { display: block; position: absolute; top: 0px; left: 0px; background-color:red; } </style> </head> <body> <div id="window"> Content </div> </body> </html>
Maybe there's a simple error that I'm not seeing, i've spent too much time using Jquery, so probably I got too confortable on that.
Sorry for my bad english, it's not my native language.
Thank you all


Reply With Quote

Bookmarks