All manner of web development issues discussed, but with a heavy focus on CSS.

Menu

Template Updates

I’ve made several updates to existing layouts. Most notable is a bit of an update to the ever useful ruthsarian_utilities.js. I’ve updated the event_attach function so that it actually works as intended. More on that in a bit. I also removed my own min-width emulation code for IE and am sticking strictly to the PVII code because, as I found out, there are some serious issues with my approach on older browsers. I also went through and added proper attribution/credits which should have been there from the very beginning.

I’ve moved all the skidoo-based layouts back to HTML 4.01 strict DTDs. The reason is simple enough, XHTML specs specify that to be correct XHTML, your web server should return a mime-type of application/xhtml+xml when serving XHTML documents. However, most return the HTML mime-type of text/html. Also, a number of browsers will display the page as plain text if given the XHTML mime-type. Opera 7.01 and later accepts that mime-type, and you can reghack IE to do so as well. But in the interests of being “correct”, I’m converting back to HTML 4.01 strict.

So if you’re playing around with one of these templates, you might want to pick up a copy of the updated version.

Now, back to the event_attach stuff. IE supports a window.attachEvent which will allow you to apply multiple functions to the onload event. (Opera supports this as well.) However Gecko-based browsers do not. For those, we’re left with the old school window.onload = myFunc;. So to attach multiple function to an event I created the event_attach function which creates an array for a given event and populates the array with pointers to the functions you want to execute on that event.

Nifty.

One sticky problem: order of execution. With IE, the last function attached, is the first to execute, a method known as LIFO. Opera’s version of the window.attachEvent does just the opposite; it’s FIFO. So which do I emulate for non-attachEvent browsers? Since IE has the larger marketshare, I decided to mimic IE. I prefer the method Opera uses, but I’m playing to real-world usage here.

Another approach would be to ditch using the window.attachEvent function alltogether. However I prefer to use functionality if it’s there, rather than reinvent the wheel. But if you feel otherwise, feel free to alter the script to your liking.

Advertisements

Like this:

LikeLoading...

Related

Post navigation

0 thoughts on “Template Updates”

Great templates, I have really enjoyed spending a few hours with your example layouts. Since deciding this morning to make the jump from tabular html design to a CSS approach, I have found your site very useful. Keep up the good work.

It is invaluable for me to have something to break apart and build back up again for me to learn about this – so finding some great layouts to do this with is excellent. Learning from a book from scratch is probably the best way but for me a more practical approach is the best.

I have lots of questions, but with it being my first day on my journey I will try and figure out a few of those on my own first. [Namely combining the sheets into 1 single css – I am neither combining them correctly or referring to them correctly on the html page]