Archive for September, 2006

Tips For Business

Friday, September 29th, 2006 at 2:12pm

I was perusing Derek Featherstone’s blog the other day (entitled Box of Chocolates, which immediately got my attention!) when I came across two articles of interest about success in business:

Five Business Mistakes I’ve Made
Ten Smart Moves to Improve your Business

Both contain wise words, which are now of particular relevence to me, since I heard yesterday that my current employer has agreed to let me take voluntary redundancy in the New Year. Looks like I’ll be working my notice and then free to set up my own freelance design & development company with my payoff! All very exciting, and just a little scary; but I’m looking forward to the challenge immensely.

Playpen #3 – Changing Your Stripes

Wednesday, September 27th, 2006 at 4:11pm

You know what they say about Leopards… well at least you can get a table to change its stripes with a bit of DOM scripting.

It’s a fairly trivial problem, but seeing as I’m pretty green when it comes to unobtrusive JavaScript, it’s somewhere to start!

The Playpen #3 page shows off the table, which has a new class added on alternate rows, and defines a new background colour in the CSS. OnMouseOver will change the class again, to give another colour. But I’m having real trouble resetting the original class/colour onMouseOut… It’s probably because the DOM is changed on the fly, and the original (not moused over) state of the alternate row is never actually “stored” on the page. If anyone has any suggestions, I’d be very interested to hear.

For the record, my stripeTables script looks like this:

function stripeTables() {
if (!document.getElementsByTagName) return false;
var tables = document.getElementsByTagName(“table”);
for (var i=0; i<tables.length; i++) {
var odd = false;
var rows = tables[i].getElementsByTagName(“tr”);
for (var j=0; j<rows.length; j++) {
if (odd == true) {
addClass(rows[j],”altrow”);
odd = false;
} else {
odd = true;
}
}
}
}

addLoadEvent(stripeTables);

And this is highlightRows:

function highlightRows() {
if(!document.getElementsByTagName) return false;
var rows = document.getElementsByTagName(“tr”);
for (var i=0; i<rows.length; i++) {
var rowclass = rows[i].getAttribute(“class”);
rows[i].onmouseover = function() {
addClass(this,”highlight”);
}
rows[i].onmouseout = function() {
this.setAttribute(“class” , “rowclass[i]“);
}
}
}
addLoadEvent(highlightRows);

I thought getting the Class attribute and storing as rowclass would allow me to reset it to what it was before the onMouseOver event, but sadly the table rows become unstripey once they are moused over!

The only other way I can think of doing it is writing some sort of subtractClass script to complement addClass, but seeing as this will almost certainly involve hideous regular expressions, I’m rather shying away from that.

Anyone have any ideas what I’m doing wrong?

Upcoming Events

Sunday, September 24th, 2006 at 8:44pm

I’ve recently signed up for Upcoming.org so I can keep an eye out on what’s in the pipeline in the near future. Two events caught my eye, coincidentally on consecutive evenings (all we need is a third one and they’ll be like London Buses…)

Thursday 19th October
Web Standards Group Meeting # 2 where Microformats will be discussed. See Muffinresearch.co.uk for more details.

Friday 20th October
London Geek Dinner, special guest Molly E. Holzschlag. See the Geek Dinner website for more details.

Both events look like a good evening; perhaps I’ll see some of you there.