1. JavaScript / Говнокод #3951

    +143

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    function changeAlign() {
    try {
    		for(var i = 0; i < document.getElementById("tariff_content").getElementsByTagName("table").length; i++) {
    			if(document.getElementById("tariff_content").getElementsByTagName("table")[i].className == "common") {
    				document.getElementById("tariff_content").getElementsByTagName("table")[i].removeAttribute("cellPadding"); 
    				document.getElementById("tariff_content").getElementsByTagName("table")[i].removeAttribute("cellSpacing");
    				if(document.getElementById("tariff_content").getElementsByTagName("table")[i].tBodies[0].rows[0].cells[0].className != "header"){
    					var firstTDCount = 0;
    					for(var z = 0; z < document.getElementById("tariff_content").getElementsByTagName("table")[i].tBodies[0].rows[0].cells.length; z++) {
    						firstTDCount = firstTDCount + (document.getElementById("tariff_content").getElementsByTagName("table")[i].tBodies[0].rows[0].cells[z].colSpan);
    					}
    					document.getElementById("tariff_content").getElementsByTagName("table")[i].tBodies[0].insertRow(0);
    					for(var j = 0; j < firstTDCount; j++) {
    						document.getElementById("tariff_content").getElementsByTagName("table")[i].tBodies[0].rows[0].insertCell(j);
    						document.getElementById("tariff_content").getElementsByTagName("table")[i].tBodies[0].rows[0].cells[j].className = "header";
    							document.getElementById("tariff_content").getElementsByTagName("table")[i].tBodies[0].rows[0].cells[j].innerText = " "; 
    					}
    				}				
    				for(var j = 0; j < document.getElementById("tariff_content").getElementsByTagName("table")[i].rows.length; j++) {
    					for(var k = 0; k < document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells.length; k++) {
    						if( 
    							 (document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells.length > 1) && (k != 0) 
    						   	 && (document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k].className != "header")
    						   ) 
    						{
    							if(document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k - 1].rowSpan == 1) {
    								document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k].style.textAlign = "right";
    								//document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k].style.backgroundColor = "red";
    							}
    							if(document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k].colSpan == 2) {
    								document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k].style.textAlign = "center";
    							}
    							if(document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k].style.width == "60px") {
    								//document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].style.backgroundColor = "red";
    								document.getElementById("tariff_content").getElementsByTagName("table")[i].deleteRow(j);
    								break;
    								//document.getElementById("tariff_content").getElementsByTagName("table")[i].rows[j].cells[k].style.width = "";
    							}
    						}
    					}
    				}
    			}
    		}				
    } catch(e) {}	
    return false;	
    }

    http://www.mts.ru/upload/images/script/js.js

    Запостил: Lure Of Chaos, 12 Августа 2010

    Комментарии (4) RSS

    Добавить комментарий