Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the ways of citing javascript?

Shulou Source: shulou.com Published: 2022-06-01 06:26:57 09月27日 Update

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!

Tags: Tags methods pages events code attributes files examples learning independence location content functions steps Zhongtong that is ideas situations tutorials articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology Shulou Tech Info MySQL Huawei