Эта статья в основном представляет JS с использованием для цикла для поиска элементов с обходом массива дочерних узлов
function nextchildNode (node, clazz, tagname) {var count = node.childlementcount; for (var i = 0; i <count; i ++) {if (node == undefined || node.children [i] == undefined) {продолжить; } if (clazz) {if (node.children [i] .getattribute ('class') == clazz) {return node.children [i]; }} else {if (node.children [i] .tagname == tagname) {return node.children [i]; }}} return null; } function getChildNode (node, classarg, tagnodearg) {for (var i = 0; i <classarg.length; i ++) {node = nextchildnode (node, classarg [i]); } for (var i = 0; i <tagnodearg.length; i ++) {node = nextchildnode (узел, null, tagnodearg [i]); } return node; } function getItemid (node) {var classnode = ['iteminfo', 'itemdesc'], tagnode = ['p', 'button']; node = getChildNode (Node, ClassNode, Tagnode); alert (node.getattribute ('itemid')); } #Calling функции getItemid ($ (". Shopitem") [0]);