我需要添加一个像这样的块。
我正在尝试这样做。但是在这里,td元素没有被图像元素添加。
<td valign="bottom" width="25%">
<a href="/images/00000.jpg">
<img width="150" height="100" src="http://farm4.static.flickr.com/3114/2524849923_1c191ef42e.jpg" border="0" alt="Click" title="Click"></a>
</td>
我正在尝试这样做。但是在这里,td元素没有被图像元素添加。
var img = document.createElement("img");
img.src = src;
img.width = width;
img.height = height;
img.alt = alt;
img.onclick=function () { alert(src); };
td=td.appendChild(img);
alert(td);
document.body.appendChild(td);
document.createElement("td")
创建了td
元素?同时将td
添加到 body 是无效的,应该将其添加到一个tr
中(tr
在表格内)。 - bummzack