Javascript-форум (https://javascript.ru/forum/)
-   Internet Explorer (https://javascript.ru/forum/css-html-internet-explorer/)
-   -   Не работает document.createElement("table") под IE6 (https://javascript.ru/forum/css-html-internet-explorer/5121-ne-rabotaet-document-createelement-table-pod-ie6.html)

Tigran 17.09.2009 12:33

Не работает document.createElement("table") под IE6
 
Вот код:

function create_table( country, country_lang )
{
var i;
var el=document.createElement("table");
  el.border="0";
  el.cellPadding="0";
  el.cellSpacing="0";
  el.width="100%";
  
var tr=document.createElement("tr");

  for ( i=0; i<3; i++ )
  	  tr.appendChild(document.createElement("td"));
											
  tr.childNodes[0].style.backgroundImage="url(../../Pictures/1.jpg)";
  tr.childNodes[0].style.width="5px";
  tr.childNodes[0].style.height="5px";
  
  tr.childNodes[1].style.backgroundImage="url(../../Pictures/2.jpg)";
  tr.childNodes[1].style.backgroundRepeat="repeat-x";
  tr.childNodes[1].className="kts";
  
  tr.childNodes[2].style.backgroundImage="url(../../Pictures/3.jpg)";
  tr.childNodes[2].style.width="5px";
  tr.childNodes[2].style.height="5px";
  
  el.appendChild(tr);
  
  tr=document.createElement("tr");
  
  for ( i=0; i<3; i++ )
  	  tr.appendChild(document.createElement("td"));
  
  tr.childNodes[0].style.backgroundImage="url(../../Pictures/4.jpg)";
  tr.childNodes[0].style.backgroundRepeat="repeat-y";
  tr.childNodes[0].className="kts";
  
  tr.childNodes[1].className="kts";
  tr.childNodes[1].align="center";
  
var img=document.createElement("img");
  
var tn="../../Pictures/";
	tn+=country;
	tn+=".jpg";
	img.src=tn;
	
	if ( country=="CL" || country=="EL" )
	{
	  img.width="17";
	  img.height="25";
	  img.align="left";
	}
	else
	{
	  img.width="21";
	  img.height="13";
	}
	img.border="0";

  tr.childNodes[1].appendChild(img);
  tr.childNodes[1].appendChild(document.createTextNode(" "+country_lang));
  
  tr.childNodes[2].style.backgroundImage="url(../../Pictures/4.jpg)";
  tr.childNodes[2].style.backgroundRepeat="repeat-y";
  tr.childNodes[2].style.backgroundPosition="right";
  tr.childNodes[2].className="kts";
  
  el.appendChild(tr);  
  
var d=document.getElementById(country);
  d.vAlign="bottom";
  
  for ( i=0; d.childNodes[i].nodeName.toLowerCase()!="a"; i++ );
  
  d.replaceChild(el,d.childNodes[i]);
}

Octane 17.09.2009 12:37

<tbody> нужно создавать или пользоваться специальными методами для таблиц.


Часовой пояс GMT +3, время: 18:25.