当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


HTML DOM console.trace()用法及代码示例


此console.trace()方法用于显示跟踪,该跟踪表示代码在特定点如何结束。

用法:

console.trace( label )

参数:此方法接受单个参数标签。


Example:

<!DOCTYPE html> 
<html> 
    <head> 
        <title>console.trace() Method</title> 
        <style> 
            h1 { 
                color:green; 
            } 
            body { 
                text-align:center; 
            } 
        </style> 
    </head> 
    <body> 
        <h1>GeeksforGeeks</h1> 
        <h2>console.trace() Method</h2> 
        <p>Press F12 to view the result</p> 
        <button onclick="Function()">Start Trace</button> 
        <script> 
            function Function() { 
              OtherFunction(); 
            } 
            function OtherFunction() { 
              console.trace(); 
            } 
        </script> 
      
    </body> 
</html>

输出:

支持的浏览器:console.trace()方法支持的浏览器如下:

  • chrome
  • Internet Explorer 11.0
  • Firefox 10.0
  • Opera
  • Safari 4.0


相关用法


注:本文由纯净天空筛选整理自Mahadev99大神的英文原创作品 HTML | DOM console.trace() Method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。