[thelist] Can you create tags in xhtml?

Mark Kennedy mark at eurogamer.net
Wed Feb 18 10:11:55 CST 2004


>However, I can't think of any reliable method of getting a pointer to the 
>collection of divs whose class is editWidgets (from a .js file).

Just write a function like the one I've knocked out below (javascript's a bit
rusty, but you'll get the idea).

function getAllElementsOfClass( tagname, class ) {
	c = 0;
	ret = new Array();
	source = document.getElementsByTagname( tagname );
	for( i = 0; i < source.length; i ++ ) {
		if( source[ i ].className == class;
		ret[ c++ ] = source[ i ];
	}
	return ret;
}

editwidgets = getAllElementsOfClass( "DIV", "editwidget" );

Pretty slow I know :)

MS had their whole 'behavior' (with US spelling and all) system which was great
for this sort of thing.  But it didn't get adopted into any standard and I'm
not sure if anything at all like this is on the horizon.

Mark





More information about the thelist mailing list