使用document获取元素html

使用document获取元素html 欧嘉怡

<input type="button" onclick="jiedian()" value="html子节点"><!--按钮 -->

<input type="button" onclick="tobu()" value="head子节点"><!--按钮 -->

<input type="button" onclick="weibu()" value="body子节点"><!--按钮 -->

<input type="button" onclick="yuasu()" value="所有元素"><!--按钮 -->

<input type="button" onclick="diyi()" value="获取第一个li"><!--按钮 -->

<input type="button" onclick="zuiho()" value="获取第一个li"><!--按钮 -->

<script>

function jiedian() {

console.log(documentElement); //html子节点

}

function tobu() {

console.log(document.head);//head子节点

}

function weibu() {

console.log(document.body);//body子节点

}

function yuasu() {

console.log(document.all);//所有元素

}

function diyi() {

console.log(document.firstElementChild.firstElementChild);//获取第一个li

}

function zuiho() {

console.log(document.lastElementChild.lastElementChild);//获取第一个li

}

还能输出{{restrictNumber}}个字符  
  • {{reply.author}}

    {{CommonUtil.formateDate(reply.ac_CommentDate).shortTime}}
  • 回复了{{Comments.author}} :