Image name 属性

定义和用法
name 属性可设置或返回图像的名称。
语法
imageObject.name=name
浏览器支持
所有主要浏览器都支持 name 属性
实例
实例
返回图片的名称:
<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>
尝试一下 »

更多建议: