/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; } }