本文實例講述了JS獲取iframe中longdesc屬性的方法。分享給大家供大家參考。具體如下:
longdesc 屬性指向一個包含描述信息的頁面。
<!DOCTYPE html>
<html>
<body>
<iframe id="myframe" src="/default.asp" longdesc="cnblogs.com">
<p>Your browser does not support iframes.</p>
</iframe>
<p>The URL of the long description is:
<script>
document.write(document.getElementById("myframe").longDesc);
</script>
<p>
</body>
</html>
上面的代碼返回如下結果:The URL of the long description is:cnblogs.com
希望本文所述對大家的javascript程序設計有所幫助。