Blog2005 ≫ More Javascript

Found the source of my problem with internet explorer, it's with

var c = obj.getAttribute('class');

need to replace it with

var c = getAttribute(obj,'class'); function getAttribute( elm, aname ) { var avalue = elm.getAttribute( aname ); if ( ! avalue ) { for ( var i = 0; i < elm.attributes.length; i ++ ) { var taName = elm.attributes[i].name.toLowerCase(); if ( taName == aname ) { avalue = elm.attributes[i].value; } } } return avalue; }

Not sure why internet explorer isn't picking up getAttribute reliably, but it's not. Had to rewrite setAttribute in a similar way too. Oh yeah, very first search result above solves things in a much smarter way...

SO, hopefully, when this page loads a script runs through it checking for posts older than your last visit (currently only logging the last time you posted), and shrinking them down. It pops some admin links into posts too, but you'd only see them if you were logged in. Source code is here, not that it's terribly useful to anyone. Known bugs right now are the multiple + and - links being attached to replies to replies, and I need to check the date of the latest reply to a post, instead of just the date of the message, and I don't really want to shrink a post down if it's the only one on a page. Probably want to leave the first post expanded if they following the rules above shrinks them all down too... It's a laugh though innit...

UPDATE: WOO, my little icons line up nicely now on my AJAX popup database selector thing that I use all over the shop... go play popex or join popex or go to add a new event to the Folkestone Gerald calendar to see it slotting neatly into place.

Inspired by this I'm off to do more AJAX!

js: Programming language of the internets, mostly how I make my living.

💬 RE: More Javascript - 4175

⬅️ :: ➡️

Paul Clarke's weblog - I live in A small town. Married to Clare and dad to 2, I am a full stack web developr, + I do mostly js / Node, some ruby, python, php ect ect. I like pubbing, parkrun, eating, home automation + other diy jiggery-pokery, history, genealogy, Television, squirrels, pirates, lego, and TIME TRAVEL.