JS DOM title属性,获取标题

title属性

要通过JavaScript获取当前文档的title元素定义的文档标题,可以通过document对象的title属性。


语法

document.title

返回值

string字符串


title属性实例代码,及在线编辑器

<script>
  var title = document.title
  alert(title+' 类型为:'+typeof(title))
</script>

全栈前端 / JavaScript语法 :





















Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.