The src in JavaScript is: 1. Specify the attribute of the language in which the browser interprets the script code; 2. Specify the language in which the browser interprets the script code; 3. Specify the file where the script is located, and pass the content after src to Server; 4. Specify the size of the script.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
What is the role of the src attribute in JavaScript language?
Specify the properties of the language in which the browser interprets the script code, specify the language in which the browser interprets the script code, specify the file where the script is located, and specify the size of the script.
Specify the file where the script is located, which represents the js file you imported. However, this function is mainly for cross-domain or other purposes, mainly to pass the content behind your src to the server.
src is the abbreviation of the word source, indicating the source file path. Commonly used ones are
<script src="路径"></script> <img src="路径">/script>
JS files are not HTM files, so there cannot be HTML tags inside (except for the HTML tags included in the Output statement) .
Even though it is possible to use the <script> tag in the JS file, since the JS file itself is called by the <script src="..."> tag, this will become a duplicate tag, which is a negative for the snake drawing of supplement. </p> <p>JS is a script file and consists of script code. Essentially, the normal <script> and </script> tags between the lines of code are cut into a new file that is a JS file, and the filename is then put into the script's SRC attribute.
[Recommended learning: javascript advanced tutorial]
The above is the detailed content of What does src mean in javascript. For more information, please follow other related articles on the PHP Chinese website!