这是我网页上的代码的一部分,我创建了一个 5x5 的表格,并将图像传递到该表格。我想要,如果可以碰巧使用搜索功能,每次有人选择一张照片来显示消息时有多少次在同一张桌子上存在这张照片,它将标记它的修订。(边框=“5”)。我遇到问题的功能是这个。
function search(e){
//on that function
//randomNumber = Math.round(Math.random() * 9);
//document.getElementById("anumber").innerHTML = "click on images: " + randomNumber;
//I am not sure if Is this the way to do it.
}
<body onload="loadImages()">
<table border="1" style="width: 100%" id="myT" onclick="search(event)">
<tbody><tr>
<td><img src="./my_files/k5.jpg"></td>
<td><img src="./my_files/k2.jpg"></td>
<td><img src="./my_files/k2.jpg"></td>
<td><img src="./my_files/k4.jpg"></td>
<td><img src="./my_files/k2.jpg"></td>
</tr>
<tr>
<td><img src="./my_files/k3.jpg"></td>
<td><img src="./my_files/k3.jpg"></td>
<td><img src="./my_files/k4.jpg"></td>
<td><img src="./my_files/k4.jpg"></td>
<td><img src="./my_files/k1.jpg"></td>
</tr>
<tr>
<td><img src="./my_files/k4.jpg"></td>
<td><img src="./my_files/k2.jpg"></td>
<td><img src="./my_files/k2.jpg"></td>
<td><img src="./my_files/k4.jpg"></td>
<td><img src="./my_files/k2.jpg"></td>
</tr>
<tr>
<td><img src="./my_files/k1.jpg"></td>
<td><img src="./my_files/k5.jpg"></td>
<td><img src="./my_files/k5.jpg"></td>
<td><img src="./my_files/k3.jpg"></td>
<td><img src="./my_files/k2.jpg"></td>
</tr>
<tr>
<td><img src="./my_files/k5.jpg"></td>
<td><img src="./my_files/k3.jpg"></td>
<td><img src="./my_files/k5.jpg"></td>
<td><img src="./my_files/k5.jpg"></td>
<td><img src="./my_files/k5.jpg"></td>
</tr>
</tbody></table>
慕运维8079593
相关分类