Also, I'm pretty sure you're not supposed to write the CSS in the JavaScript like that - it's better to create CSS classes and just have the JavaScript change which class is on an element.
You're right; it would be faster that way. I'll probably be going through my code to make sure I use classes wherever possible later on when I try to do some optimizing.
That's what the browser is supposed to do, though.
It's not very easy to get exactly what you want with CSS. Handling everything with my own code directly I can fairly quickly and precisely implement a GUI exactly how I want it to be without any compromises. I might not be using the best practices, but I'm not sure I would be able to achieve the same results if I were. What I have to make literally cannot be done without a lot of javascript anyways, and more javascript and less CSS really is negligible in terms of performance or any other possible benefit. Maybe I have had to write more code than I would have had to using just CSS, but it was less of a head ache and more fun.
I don't have a vendetta against JavaScript, I'm just concerned about your absolute positioning habit. I can understand if you're using it to shave off development time, but all the sources I read tell me it's bad practice and leads to multiple issues. It may work great for you, but I'm going to avoid it.
I have two reasons for avoiding JavaScript with this project:
- I want to focus on HTML5 and CSS3, and it looks like JavaScript would make me spend less time doing that (so many things are easier in JavaScript)
- The reply form on this forum is dynamically created instead of hidden and displayed, so if you accidentally navigate away from the page and navigate back, your post is gone
Other than that, I would totally use JavaScript in normal circumstances.