More Javascript


More Javascript

Recommended / related
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!


javascript: a major programming language of the internets, mostly how I make my living
TweetComment / reply

RE: More Javascript

I'm not sure (!variable) is the same as (variable!=null) is it?

Also does IE support getAttribute() as expected? You should be testing for the presence of the method if you're using DOM.

if (obj.getAttribute && (otherTests)) { // use DOM method... }
else { // do it the hard way... }
20 Nov TweetComment / reply

Paul Clarke's blog - I work and live in Seabrook near Folkestone, Kent. wed to Clare and father to two, I am a software engineer, and I do mostly javascript, Node, python, ruby, and php. I like pubs, restaurants, home automation and other diy jiggery-pokery, history, genealogy, TV, popbitch, squirrels, pirates ☠, lego, and time travel.

Also from the same week

Some more posts from the same week as .

Google Analytics [Mon 14 November 2005]

BBC NEWS | Asia-Pacific | Korean dish 'may cure bird flu' BBC is very responsible to report that there's a rumour... [Mon 14 November 2005]

More furniture There's another bit of the furniture we've been buying... [Tue 15 November 2005]

RE: More furniture They haven't gone and got a Pizza Express in old folky... [Tue 15 November 2005]

Unfortunately not, the nearest one's probably Canterbury Folkestone is progressing though, we've got a Subway now,... [Wed 16 November 2005]

Result The TV Go Home Book fetches big bucks on ebay ... well... [Wed 16 November 2005]

Google Base Google Base is up and running then... See my posted... [Wed 16 November 2005]

Up to my arse in javascript Doing some testing on here that I'll be using on popex... [Thu 17 November 2005]

RE: Up to my arse in javascript I would never open a bank account without first checking... [Thu 17 November 2005]

Cheers, very handy not arsed about interest, just need an account we can pay... [Thu 17 November 2005]

RE: Up to my arse in javascript we have our joint account with them - all... [Thu 17 November 2005]

ah but do they offer a free crate of wine to new applicants? Cheers for the tip, but I was in a hurry so I've given... [Thu 17 November 2005]

More Javascript Found the source of my problem with internet explorer,... [Thu 17 November 2005]

RE: More Javascript I'm not sure (!variable) is the same as (variable!=null)... [Sun 20 November 2005]

canterbury beetle pay day dentist leak new york rum punch sports centre take it easy chicken vegan oasis tax inn doors mansun plumber center parcs coffee table share save swimming dry january holiday snow manson swimming lessons mot florida weather not drinking pizza en-suite step count

Paul Clarke





Privacy policy