Image name 屬性

定義和用法
name 屬性可設(shè)置或返回圖像的名稱。
語(yǔ)法
imageObject.name=name
瀏覽器支持
所有主要瀏覽器都支持 name 屬性
實(shí)例
實(shí)例
返回圖片的名稱:
<html>
<body>
<img id="compman" name="compman"
src="compman.gif" alt="Computerman" width="107" height="98">
<br>
<script>
document.write("Image name: ");
document.write(document.getElementById('compman').name);
</script>
</body>
</html>
<body>
<img id="compman" name="compman"
src="compman.gif" alt="Computerman" width="107" height="98">
<br>
<script>
document.write("Image name: ");
document.write(document.getElementById('compman').name);
</script>
</body>
</html>
嘗試一下 ?

更多建議: