Return to Snippet

Revision: 12137
at March 3, 2009 10:37 by tclancy


Initial Code
function getPosition(main,spec) {
        var items = main.getElementsByTagName(spec.tagName);
        var found = 0;
        for (p = 0; p < items.length; p++) {
                if (items[p] == spec) {
                        found = 1;
                        break;
                }
        }
        if (found) {
                return p;
        }
        else {
                return -1;
        }
}

Initial URL

                                

Initial Description

                                

Initial Title
Find Element Position

Initial Tags

                                

Initial Language
JavaScript