• Skip to main content
  • Skip to search
  • Skip to select language

Learn front-end development with high quality, interactive courses from Scrimba. Enroll now!

MDN Web Docs
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Extensions

      Developing extensions for web browsers

    • Accessibility

      Build web projects usable for all

    • Web Technology

      Web technology reference for developers

  • Learn
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • Plus
    • Overview

      A customized MDN experience

    • AI Help

      Get real-time assistance and support

    • Updates

      All browser compatibility updates at a glance

    • Documentation

      Learn how to use MDN Plus

    • FAQ

      Frequently asked questions about MDN Plus

  • Curriculum New
  • Blog
    • Playground

      Write, test and share your code

    • HTTP Observatory

      Scan a website for free

    • AI Help

      Get real-time assistance and support

  1. 面向开发者的 Web 技术
  2. Web API
  3. ErrorEvent
  4. ErrorEvent:lineno 属性
    • Is this useful?
    • English (US)
    • Deutsch

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

在本文中

  • 值
  • 示例
  • 规范
  • 浏览器兼容性
  1. HTML DOM API
  2. ErrorEvent
  3. 构造函数
    1. ErrorEvent()
  4. 实例属性
    1. colno
    2. error
    3. filename
    4. lineno
    5. message
  5. 继承
    1. Event
  6. HTML DOM 的相关页面
    1. BeforeUnloadEvent
    2. DOMStringMap
    3. HTMLAnchorElement
    4. HTMLAreaElement
    5. HTMLAudioElement
    6. HTMLBRElement
    7. HTMLBaseElement
    8. HTMLBodyElement
    9. HTMLButtonElement
    10. HTMLCanvasElement
    11. HTMLDListElement
    12. HTMLDataElement
    13. HTMLDataListElement
    14. HTMLDialogElement
    15. HTMLDivElement
    16. HTMLDocument
    17. HTMLElement
    18. HTMLEmbedElement
    19. HTMLFieldSetElement
    20. HTMLFormControlsCollection
    21. HTMLFormElement
    22. HTMLFrameSetElement 已弃用
    23. HTMLHRElement
    24. HTMLHeadElement
    25. HTMLHeadingElement
    26. HTMLHtmlElement
    27. HTMLIFrameElement
    28. HTMLImageElement
    29. HTMLInputElement
    30. HTMLLIElement
    31. HTMLLabelElement
    32. HTMLLegendElement
    33. HTMLLinkElement
    34. HTMLMapElement
    35. HTMLMediaElement
    36. HTMLMenuElement
    37. HTMLMetaElement
    38. HTMLMeterElement
    39. HTMLModElement
    40. HTMLOListElement
    41. HTMLObjectElement
    42. HTMLOptGroupElement
    43. HTMLOptionElement
    44. HTMLOptionsCollection
    45. HTMLOutputElement
    46. HTMLParagraphElement
    47. HTMLPictureElement
    48. HTMLPreElement
    49. HTMLProgressElement
    50. HTMLQuoteElement
    51. HTMLScriptElement
    52. HTMLSelectElement
    53. HTMLSourceElement
    54. HTMLSpanElement
    55. HTMLStyleElement
    56. HTMLTableCaptionElement
    57. HTMLTableCellElement
    58. HTMLTableColElement
    59. HTMLTableElement
    60. HTMLTableRowElement
    61. HTMLTableSectionElement
    62. HTMLTemplateElement
    63. HTMLTextAreaElement
    64. HTMLTimeElement
    65. HTMLTitleElement
    66. HTMLTrackElement
    67. HTMLUListElement
    68. HTMLUnknownElement
    69. HTMLVideoElement
    70. HashChangeEvent
    71. History
    72. ImageData
    73. Location
    74. MessageChannel
    75. MessageEvent
    76. MessagePort
    77. Navigator
    78. PageRevealEvent
    79. PageSwapEvent
    80. PageTransitionEvent
    81. Plugin 已弃用
    82. PluginArray 已弃用
    83. PromiseRejectionEvent
    84. RadioNodeList
    85. UserActivation
    86. ValidityState
    87. Window
    88. WorkletGlobalScope

在本文中

  • 值
  • 示例
  • 规范
  • 浏览器兼容性

ErrorEvent:lineno 属性

备注: 此特性在 Web Worker 中可用。

ErrorEvent 接口的 lineno 只读属性返回一个整数,表示发生的错误在脚本文件中所位于的行号。

值

整数。

示例

js
window.addEventListener("error", (ev) => {
  console.log("错误发生在第 " + ev.lineno + " 行");
});

规范

Specification
HTML
# dom-errorevent-lineno

浏览器兼容性

Help improve MDN

Learn how to contribute.

This page was last modified on 2025年2月10日 by MDN contributors.

View this page on GitHub • Report a problem with this content
MDN logo

Your blueprint for a better internet.

  • MDN on Bluesky
  • MDN on Mastodon
  • MDN on X (formerly Twitter)
  • MDN on GitHub
  • MDN Blog RSS Feed

MDN

  • About
  • Blog
  • Careers
  • Advertise with us

Support

  • Product help
  • Report an issue

Our communities

  • MDN Community
  • MDN Forum
  • MDN Chat

Developers

  • Web Technologies
  • Learn Web Development
  • MDN Plus
  • Hacks Blog
  • Website Privacy Notice
  • Cookies
  • Legal
  • Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2025 by individual mozilla.org contributors. Content available under a Creative Commons license.