日期:2014-05-16 浏览次数:20511 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script> //Horizontal=横向列数 //Vertical=向下行数 //Width=图片宽度 //Heigh=图片告诉 function addRow(Horizontal,Vertical,Width,Height) { var MyTable = document.getElementById("MyTable"); var MyTbody = document.getElementById("MyTbody"); TbodyTotal=1 for (i=1;i<=Horizontal;i++){ MyTR = document.createElement("tr"); MyTR.setAttribute("id","tr"); for (j=1;j<=Vertical;j++){ MyTD = document.createElement("td"); MyTD.align = "center"; MyImg = document.createElement("img"); MyImg.height = Width; MyImg.width = Height; //--------------------- Mya = document.createElement("A"); Mya.href="http://www.163.com"; Mya.appendChild(MyImg); //---------------- MyTD.appendChild(Mya); MyBr = document.createElement("br"); MyTD.appendChild(MyBr); MyDiv1 = document.createElement("div"); MyTxt = document.createTextNode("价格"); MyTD.appendChild(MyTxt); MyTD.appendChild(MyDiv1); MyDiv2 = document.createElement("div"); var a = document.createElement("a"); a.href = "#"; a.innerHTML = "**产品名**"; MyTD.appendChild(a); MyTD.appendChild(MyDiv2); MyTR.appendChild(MyTD); TbodyTotal++; } MyTbody.appendChild(MyTR); } } function addRow2(Horizontal,Vertical,Width,Height) { var MyTable = document.getElementById("MyTable"); var MyTbody = document.getElementById("MyTbody"); TbodyTotal=1 for (i=1;i<=Horizontal;i++){ MyTR = document.createElement("tr"); MyTR.setAttribute("id","tr"); for (j=1;j<=Vertical;j++){ MyTD = document.createElement("td"); MyTD.align = "center"; MyImg = document.createElement("img"); MyImg.height = Width; MyImg.width = Height; //--------------------- Mya = document.createElement("A"); Mya.href="http://www.baidu.com"; Mya.appendChild(MyImg); //---------------- MyTD.appendChild(Mya); MyBr = document.createElement("br"); MyTD.appendChild(MyBr); MyDiv1 = document.createElement("div");