HTML DOM Image longDesc 屬性
定義和用法
longDesc 屬性可設置或返回圖片的longDesc 屬性值。
longdesc 屬性指定了包含圖像描述的文檔的URL。
語法
imageObject.longDesc=URL
瀏覽器支持
所有主要瀏覽器都支持longDesc 屬性
實例
實例
返回圖片的longDesc 屬性值:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<img id="compman" src="compman.gif" longdesc="description.htm" alt="Computerman" width="107" height="98">
<br>
<p>longdesc属性的值为:
<script>
var x=document.getElementById("compman");
document.write(document.getElementById("compman").longDesc);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<img id="compman" src="compman.gif" longdesc="description.htm" alt="Computerman" width="107" height="98">
<br>
<p>longdesc属性的值为:
<script>
var x=document.getElementById("compman");
document.write(document.getElementById("compman").longDesc);
</script>
</p>
</body>
</html>
嘗試一下»
Image對象