RE: More Javascript
Home
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!
2005 :: Comment / reply
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... }
pid :: 20 Nov :: 2005 :: Comment / reply
Paul Clarke's blog - I live and work near Folkestone. Married to Clare and father to Harry, I am a web dev, and I like javascript, PHP, Folkestone Gerald, pubs, restaurants, history, genealogy, TV, music, popbitch, squirrels, pirates ☠, time travel, stained glass...
Also from the same week
Some more blog posts from the same week as .
Up to my arse in javascript [Thursday 17 November 2005]
RE: Up to my arse in javascript [Thursday 17 November 2005]
Cheers, very handy [Thursday 17 November 2005]
RE: Up to my arse in javascript [Thursday 17 November 2005]
ah but do they offer a free crate of wine to new applicants? [Thursday 17 November 2005]
More Javascript [Thursday 17 November 2005]
RE: More Javascript [Sunday 20 November 2005]
Splendid weekender [Monday 21 November 2005]
Digg [Monday 21 November 2005]
as I understand it... [Monday 21 November 2005]
Bah [Monday 21 November 2005]
RE: Splendid weekender [Monday 21 November 2005]
Traversing the HTML Table with JavaScript and DOM interfaces [Tuesday 22 November 2005]
Excellent work, cheers! [Tuesday 22 November 2005]
the friend of a friend (foaf) project [Tuesday 22 November 2005]
AJAX [Tuesday 22 November 2005]
EASY! EASY! EASY! [Wednesday 23 November 2005]
Back on course [Wednesday 3 September 2003]
Firefox Help: Keyboard Shortcuts [Tuesday 22 February 2005]
RE: Splendid weekender [Friday 25 November 2005]
RE: Splendid weekender [Friday 25 November 2005]
PAY? [Friday 25 November 2005]



