minor fixes
This commit is contained in:
parent
689975093c
commit
f6ff773033
24 changed files with 67 additions and 76 deletions
|
@ -1,6 +1,6 @@
|
|||
# Hello, world!
|
||||
|
||||
This part of the tutorial is about core JavaScript, the language itself. Later on, you'll learn about Node.js and other platforms that use it.
|
||||
This part of the tutorial is about core JavaScript, the language itself.
|
||||
|
||||
But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial.
|
||||
|
||||
|
@ -46,7 +46,7 @@ The `<script>` tag contains JavaScript code which is automatically executed when
|
|||
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
|
||||
|
||||
The `type` attribute: <code><script <u>type</u>=...></code>
|
||||
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard, HTML5, totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic; we'll talk about modules in another part of the tutorial.
|
||||
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic; we'll talk about modules in another part of the tutorial.
|
||||
|
||||
The `language` attribute: <code><script <u>language</u>=...></code>
|
||||
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
|
||||
|
@ -73,9 +73,7 @@ Script files are attached to HTML with the `src` attribute:
|
|||
<script src="/path/to/script.js"></script>
|
||||
```
|
||||
|
||||
Here, `/path/to/script.js` is an absolute path to the script file (from the site root).
|
||||
|
||||
You can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
|
||||
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
|
||||
|
||||
We can give a full URL as well. For instance:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue