2010-02-09 46 views
0

有誰知道如何使用vbscript在td元素上添加圖像? 我需要添加一個「img」元素,而不是背景圖片,它必須是vbscript。使用vbscript將圖像元素添加到td

<script type="text/vbscript"> 
function onload() 
'//Add Image to td1 
end function 
<script> 
<table> 
<tr> 
<td id="td1"></td> 
</tr> 
</table> 

任何人都可以幫助我嗎?

在此先感謝。

回答

2

您只需使用DOM即可完成此操作,就像在JavaScript中一樣。

Function onload() 
    Dim img 

    Set img = document.createElement("img") 
    img.src = "http://www.google.com/intl/en_ALL/images/logo.gif" 

    document.getElementById("td1").appendChild img 
End Function