JS获得图片alt信息的方法
本文实例讲述了JS获得图片alt信息的方法。分享给大家供大家参考。具体如下:
下面的JS代码可通过图片的alt属性获得图片的提示信息
<!DOCTYPEhtml>
<html>
<body>
<imgid="compman"src="compman.gif"alt="Crazycomputerman"
width="107"height="98">
<p>Thevalueofthealtatrributeis:
<script>
document.write(document.getElementById("compman").alt);
</script>
</p>
</body>
</html>
希望本文所述对大家的javascript程序设计有所帮助。