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.
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"><script type="text/javascript" src="test.js"></script></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!