Archive: Javascript
Stylesheet Switcher - Part 2
Posted on Friday, August 18th, 2006
Yesterday I began to create a stylesheet switcher using javascript and the HTML DOM. I finished up with an example of the work so far, but I failed to address a few of the points in my requirements, namely:
- Use a dropdown box to select styles
- Populate the dropdown box with stylesheet names from the title attribute of the link tag
- Graceful degradation in browsers without script
- Future proof javascript
Today I will tackle these issues.
The DOM again - A Style Sheet Switcher
Posted on Thursday, August 17th, 2006
A comment a few days ago about the colours used on this site got me thinking. First of all I started considering what would be a nice colour to make my headings so that they were readable for everyone. Rather than stopping there and testing out some new colours, I kept thinking eventually deciding that a new design was the only way forward! Finally, thoughts of accessibillity crept into my head reminding me of Roger Johansson’s high contrast layout (originally suggested on A List Apart by Joe Clark) and it all made sense.
If I build a stylesheet switcher into my site then I can keep this design and serve up as many other ones as I like, improving accessibility and keeping the bright blueness of my headings.
Of course, doing this would test and improve my scripting (my ultimate aim) so I got to work.
First Go With The DOM - Changing Font Sizes
Posted on Wednesday, August 2nd, 2006
While this post has some interesting JavaScript in, there are also a lot of mistakes. Please have a look at fontSizer v2.0 which is much, much better!
Accessibility matters. I am trying to make this site as accessible as I can in order to learn the methods and set an example. My most recent task has been to add the links you will see at the top right of the page, links to increase or decrease the font size. Initially I searched for a quick bit of code to do this, but none of the results gave me exactly what I wanted, so I decided to do it myself, thus immersing myself in the DOM for the first time.
My requirements were a script that changed the text size on a page without loading a different stylesheet or forcing a reload and that once the text size was altered this would persist throughout the site. I also wanted to continue using relative font size attributes (this site’s font sizes are all done using ems so that IE users may resize using the browser controls). My searches found scripts that changed pixel sizes and only worked for the current page, so I got to work.
Continue reading “First Go With The DOM - Changing Font Sizes” »