Monday, June 25, 2007

Get the index number of an element

Heres a little gem I found at :
http://forums.htmlhelp.com/lofiversion/index.php/t746.html

This short little javascript allows you to detect / retrieve / get the index number of an element. Which can defiantly be useful in a number of different applications.

var p=document.getElementsByTagName('p');
for(var i=0; i
{
p[i].pnum=i;
p[i].onclick=function()
{
alert(this.pnum);
}
}

getElementsByClass

Heres a little piece of JavaScript I found at :
http://javascript.about.com/library/bldom08.htm

I'm sure it can be of use to someone else out there. This coded creates your own getElementsByClass method which is not built into javascript.

document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i <>
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};

Thursday, June 7, 2007

The Flash Tattoo Factory

Finally got around to updating the Tattoo Factory on my web site:
Chicago Web Site Design
I improved some of the functionality and added a couple of features feel free to play around with it and let me know what you think.