w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it

script src attribute

The src attribute on the script element:



6.src=URL<script src="file.js"> </script> // imported javascript
<script src="file.js" type="application/javascript "> </script> // imported javascript
<script src="http://domain.com/file.js" crossorigin=""> </script>
<script src="file.js" charset="UTF-8" async defer> </script>

Video demonstration script src attribute

HTML5 script src attribute tutorial

min video details
00:04 src attribute on script element allows you to link an external script file to the page
00:17 the HTML5 file
00:19 the external script file
00:23 this script statement will be executed only after we will link file.js to index.html
00:32 adding the correct syntax to page
00:43 the value of the src attribute represents the path=URL (absolute or relative)=address of the external script
00:53 the external script file file.js is now linked to index.html file
01:00 external script executed
01:04 linking file2.js (located in folder1) to index.html
01:23 file2.js correct path: folder1⁄file2.js
01:33 external script1 executed
01:41 if the path is wrong, the external script file is not linked to the page
01:48 only the 1st script is executed
01:56 Children restrictions:
02:08 if src attribute present:
allowed empty space, new lines or comments only
02:28 valid content within the script element
02:38 invalid content within the script element:
- script statements not allowed when scr attribute is present
script intro script inline, imported, data islands script browser display script parents - script statements script syntaxscript async attributescript charset attributescript defer attributescript type attribute