History length 屬性
定義和用法
length 屬性聲明了瀏覽器歷史列表中的元素數量。
注意: Internet Explorer和Opera從0開始,而Firefox、Chrome和Safari從1開始。
語法
history.length
瀏覽器支持
所有主要瀏覽器都支持length 屬性
實例
實例
返回在歷史列表中的網址數量:
<script>
document.write("历史列表中URL的数量: " + history.length);
</script>
document.write("历史列表中URL的数量: " + history.length);
</script>
以上實例輸出結果:
嘗試一下»
History對象