deadlock Message Board
[ November Full List | Reply ]

Re: Style Sheets better than java script?
From Edward Frederick at DevSystems on 16 Nov '99
replying to Style Sheets better than java script? posted by Inachu

With javascript versus style sheets at this point in the game, I would highly recommend javascript. Even though my tongue is flapping over style sheets, and I wish the browser giants would have gotten on the same page when they implemented the technology(e.g. netscape needs to play catch up) you have to consider both load time as well as execute time. The javascript interpreter engine is really fast, but the style sheet interpreter is faster. It really boils down to how each are being applied. Keep in mind the reusability of style sheets and the flexibility of javascript. Javascript is cleary the more powerful of the two at this point, but style sheets are more easily reused, and base style sheets (e.g. encapsulated the <A> tag for example) will be automatically reused throughout the page containing the style sheet versus javascript that requires more work to redundantly implement. I personally use a combination of both on my website and find that the best implementation. If load factor is your only concern, don't be. Both style sheets and javascript are loaded into the client as simple ascii text, and are executed after they are loaded. The true speed of both depends on the clients PC configuration and browser speed. I personally don't consider load time a significant value in this particular case.

Edward Frederick

>I see this as a new question most will ask in the future.
>Are style sheets much better than javascript?
>I am just wondering about the code size. The smaller the better.
>So I know that either one could have the potential of being the biggest of the other.
>Just worried about load factor.
>>>Please take a look at my site, especially these three pages:
>>>"use of crystal"
>>>from the menu on the left. I would like to submit these pages with search engines. Are they ready? What should I do to improve them?
>>>Also, I ran the website garage diagnostic tool on one of the pages and I have recieved about 2 milion warnings on HTML design. Something like:"Good HTML style uses an 'alt' attribute in <img>". It goes for all my roll-overs, which I created in Image ready. Shoud I be worried about this? How much weight should I put on this analysis.
>>>Thanks Rasto
>>The meta tags on the history page looked OK, but how come there were no meta tags on your main page? To get rid of those errors you can include ALT="" in each image tag. To optimize the html you can remove any "" from numbers; for example height=5 not height="5". The javascript rollover you are using can be duplicated exactly using style sheets and the hover property. Netscape folks would not get the rollover effect, but everything is still easily identified as a link.
>>Check out our page as an example. It has a rollover style menu (IE only) with no JS or images. Javascript dramatically slows down the loading of your page. Since there are no images menu items can be added or removed very easily. This is an important consideration when considering the maintenance of the page.

Reply to this message

Required Details
Your name:

Optional Details
Home page title:
Home page URL:
(if you'd like to receive automatic replies by email)

Your Message