Home > Web Front-end > Front-end Q&A > What is the extension of javascript document

What is the extension of javascript document

青灯夜游
Release: 2021-10-18 17:27:12
Original
6293 people have browsed it

The javascript document is a text file used to install javascript code. The extension is ".js", which means that the text file is a JavaScript type file and can be edited using any text editor.

What is the extension of javascript document

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

JavaScript programs can not only be placed directly in HTML documents, but also in JavaScript script files. JavaScript script files are text files with the extension .js, which means that the text file is a JavaScript type file and can be edited using any text editor.

JavaScript files cannot run independently and need to be imported into the web page and executed through the browser. JavaScript files can be imported using the <script> tag. </p> <p><script> tag needs to define the src attribute, and set the attribute value to the URL string pointing to the external JavaScript file. The code is as follows: </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:js;toolbar:false">&lt;script type=&quot;text/javascript&quot; src=&quot;test.js&quot;&gt;&lt;/script&gt;</pre><div class="contentsignin">Copy after login</div></div><p>Note: When using the <script> tag to include external JavaScript files, the default file type is Javascript. Therefore, regardless of whether the loaded file has a .js extension or not, the browser will parse it as a JavaScript script. </script>

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of What is the extension of javascript document. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template