我想要做的是使Y [0]成爲圖像,而不是文字。現在它只是鏈接而不是圖片。使文字圖像
<html>
<head>
<script type="text/javascript">
function changeContent(){
var x=document.getElementById('myTable').rows
var y=x[0].cells
y[0].innerHTML = "http://www.handicappedpets.com/wizards/img/wwmeasure2B.jpg"
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>d</td>
<td>d</td>
</tr>
<tr>
<td>d</td>
<td>d</td>
</tr>
</table>
<form>
<input type="button" onclick="changeContent()" value="Change content">
</form>
</body>
</html>
因此,使它的圖像元素,並將URL作爲'src'屬性? – Bergi
你想解決什麼*問題*這種實現非常嚴格 - 有可能採取更好的方法。 – Sampson