Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways of citing javascript?

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the citation methods of javascript". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the citation ways of javascript"?

JavaScript reference way: 1, inline reference, through the event attributes in the tag to reference js;2, internal reference, through the script tag to write js code; 3, external reference, through the script tag to reference independent js files.

The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.

How to quote javascript

There are 3 ways to quote js

1. Inline reference: a function that references js through the event attribute in the open tag

two。 Internal references: used by writing js code in script tags

1) script tags can be written anywhere on the page

2) script tags are usually used at the end of body, or after body

3. External references:

Steps:

1) write a separate js file

2) referenced in the page through the script tag

I would like to introduce:

1. Inline reference: a function that references js through the event attribute in the open tag

Example of an inline reference:

Quit and go to Taobao.

two。 Internal references: used by writing js code in script tags

1) script tags can be written anywhere on the page

2) script tags are usually used at the end of body, or after body

Example:

Function guess () {alert (this.value);} document.getElementById ("btn1") .onclick = guess

3. External references:

Steps:

1) write a separate js file

2) referenced in the page through the script tag

Example:

Thank you for reading, the above is the content of "what is the citation of javascript?" after the study of this article, I believe you have a deeper understanding of what the citation of javascript has, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report