Mooquackwooftweetmeow

Concatenating zoölogical onomatopœia since 1999

About Mooquackwooftweetmeow

Hi! This is Mooquackwooftweetmeow, a collection of stuff by Greg K Nicholson.

On-the-fly page validation

I wonder if this is possible. I've been dabbling with JavaScript a little recently, in order to produce The Twaddle's Expletatron and this seems like something that should be possible with JS:

I want a script that can load up a given remote page (internally - I don't want to display the page, just to extract info from it), look at an element on that page with a given id, and return its class as a variable.

What's this got to do with validation? Well say the remote page was http://validator.w3.org/check/referer and the given id was result. Then, if the returned variable is valid (i.e. the class of that element is valid) you've got a valid page; if the returned variable isn't valid you haven't.

So, you could, using JavaScript, whack in a Valid XHTML logo if, and only if, the page is actually valid. If you like, you could throw in an Invalid! image if the page is not valid.

I know it's possible to refer to an element by its id; I know it's possible to get the content of that element. I don't know if it's possible to get an element's class, and I'm guessing it's slightly impossible to do all this for another, remote page.

It'd be nice though.

About this entry

I published this entry on 1 June 2004 at around tea-time. That means this is pretty old. Beware parachronisms.

Questions? Comments? Plaudits? Microblog at identi.ca/gregknicholson, or with the tag #mqwtm; or email me at weblog034@gkn.me.uk.