[code="java"]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- .wd_picc1{ width:131px; height:115px; padding:5px 21px; float:left; } .wd_pic_pic{ width:130px; height:90px; } .wd_pic_text12{ width:auto; text-align:center; height:13px; } .clear{ clear:both; margin:0px; padding:0px; } --> var bfIL; function BFImage(arg0, arg1, arg2, arg3){ this.name = arg0; this.tag = arg1; this.caption = arg2; this.priceDesc = arg3; } function showBFImages(arg0, arg1){ var bfwdImageListDiv = document.getElementById(arg0); var bfImage; bfwdImageListDiv.innerHTML = ""; for(var i=1;i<=bfIL.length;i++){ bfImage = bfIL[i-1]; if(bfImage.tag==arg1){ wd_picc1 = document.createElement("div"); wd_picc1.setAttribute('class','wd_picc1'); wd_pic_pic = document.createElement("div"); wd_pic_pic.setAttribute('class','wd_pic_pic'); wd_a = document.createElement("a"); wd_a.setAttribute('href',bfImage.name); wd_a.setAttribute('rel',"lightbox[bafangwang]"); wd_a.setAttribute('title',bfImage.caption); wd_a.setAttribute('target',"_blank"); wd_img = document.createElement("img"); wd_img.setAttribute('src',bfImage.name); wd_img.setAttribute('width',"130"); wd_img.setAttribute('height',"90"); wd_a.appendChild(wd_img); wd_pic_pic.appendChild(wd_a); wd_picc1.appendChild(wd_pic_pic); wd_pic_text12 = document.createElement("div"); wd_pic_text12.innerHTML = bfImage.caption; wd_pic_text12.setAttribute('class','wd_pic_text12'); wd_picc1.appendChild(wd_pic_text12); wd_pic_text122 = document.createElement("div"); wd_pic_text122.innerHTML = bfImage.priceDesc==''?" ":bfImage.priceDesc; wd_pic_text122.setAttribute('class','wd_pic_text12'); wd_picc1.appendChild(wd_pic_text122); bfwdImageListDiv.appendChild(wd_picc1); } } document.getElementById("code").value= bfwdImageListDiv.innerHTML; }
s1
s2
[/code]
点击s1或s2 让动态生成的div 横排显示(现在ie6显示竖排,ff显示正常)