JSFiddle - React, Tailwind, and code Playground
by ledak
HTML
<table class="tabledGridView" cellspacing="0" cellpadding="4" rules="all" border="1" id="RecommendationsMeCustomer_gvRecommendationsForFirm" width="100%">
<tbody><tr>
<th scope="col">
От фирмы
</th><th scope="col">
Комментарий
</th><th scope="col"><img src="http://aii.su/Common/Icons/FirmVotes.gif" border="0"></th><th scope="col">
Добавлена
</th><th scope="col">Действие</th>
</tr><tr>
<td width="300">
<div>
<div>
<a id="RecommendationsMeCustomer_gvRecommendationsForFirm_ctl02_FirmHyperLink1_FirmLink" title="Левкова Н.Ю. ИП" class="FirmHyperLink" onclick="if (window.PopupManager) {PopupManager.Open(ViewFirmInfo, {FirmID : 450670, IsDeleted: false}); return false;} return true;" href="../Tables/Info.aspx?ID=450670&isdeleted=false"><b><span id="RecommendationsMeCustomer_gvRecommendationsForFirm_ctl02_FirmHyperLink1_lblFirmName_ShortenedLbl">Левкова Н.Ю. ИП</span></b></a>
</div>
<div>
<span id="RecommendationsMeCustomer_gvRecommendationsForFirm_ctl02_FirmHyperLink1_lblProfile" style="margin:0px; padding:0px;">Грузовладелец-перевозчик,</span>
</div>
<div>
<span id="RecommendationsMeCustomer_gvRecommendationsForFirm_ctl02_FirmHyperLink1_lblCity" style="margin:0px; padding:0px;">Москва</span>
</div>
</div>
<div>
</div>
<nobr>
<a id="RecommendationsMeCustomer_gvRecommendationsForFirm_ctl02_StarReliability2_lnkFirmPassport" onclick="if (window.PopupManager) {PopupManager.Open(ViewPassport, {FirmID : 450670, IsDeleted : false}); return false;} return true;" href="/Reliability/Firm.aspx?ID=450670" style="text-decoration:none;...
JavaScript
var test=0, arr=[], arr2=[], arr3=[], arr4=[];
$('tbody tr a.FirmHyperLink').each(function(index, value) {
var newHTML = $(this).find('span').text();
arr.push(newHTML);
//alert(newHTML);
});
$('tbody tr td:nth-child(2)').each(function(index, value) {
var rh = $(this).html().replace(/^\s+/, "");
arr2.push(rh);
// alert(rh);
});
$('tbody tr td:nth-child(4)').each(function(index, value) {
arr3.push($(this).html().replace(/^\s+/, "").replace(/\s+$/, ""));
//alert($(this).html());
});
$('tbody tr td:nth-child(1) div:nth-child(1) div:nth-child(3) span').each(function(index, value) {
arr4.push($(this).html().replace(/^\s+/, "").replace(/\s+$/, ""));
});
var maria = document.getElementById('maria');
var magicDiv = document.getElementById('mdiv');
var newUl = document.createElement('ul');
for(var i=0,l=arr.length; i<l; i++){
var newH = document.createElement('h3');
var newA = document.createElement('a');
newA.href = '#otz';
newA.className = 'showtext';
newA.innerHTML = '<strong>' + arr[i] + ' </strong><span class="naklon">(г. ' + arr4[i] + ')</span><span class="rdate">' + arr3[i] + '</span>';
var newT = document.createElement('div');
newT.className = 'htext';
newT.style.display = 'none';
newT.innerHTML = arr2[i];
newH.appendChild(newA);
var newLi = document.createElement('li');
newLi.appendChild(newH);
newLi.appendChild(newT);
newUl.appendChild(newLi);
}
magicDiv.appendChild(newUl);
maria.value = magicDiv.innerHTML;