Mondadori Store

Trova Mondadori Store

Benvenuto
Accedi o registrati

lista preferiti

Per utilizzare la funzione prodotti desiderati devi accedere o registrarti

Vai al carrello
 prodotti nel carrello

Totale  articoli

0,00 € IVA Inclusa

COMPUTER PROGRAMMING FOR BEGINNERS

Leonard Base
pubblicato da Leonard Base

Prezzo online:
0,00

There are plenty of books on this subject on the market, thanks again for choosing this one! Every effort was made to ensure it is full of as much useful information as possible, please enjoy!

What is JavaScript?

JavaScript is an interpreted programming language, so it is not necessary to compile the programs to execute them. In other words, programs written with JavaScript can be tested directly in any browser without the need for intermediate processes.

Despite its name, JavaScript has no direct relationship with the Java programming language.

How to include JavaScript in XHTML documents

The integration of JavaScript and XHTML is very flexible since there are at least three ways to include JavaScript code in web pages.

Include JavaScript in the same XHTML document

The JavaScript code is enclosed between <script> tags and is included anywhere in the document. Although it is correct to include any block of code in any area of the page, it is recommended to define the JavaScript code within the header of the document (within the tag).

Example of JavaScript code in the document itself

<script> alert ("A test message"); </script>

A paragraph of text.

In order for the resulting XHTML page to be valid, it is necessary to add the type attribute to the < script>. The values included in the type attribute are standardized and in the case of JavaScript, the correct value is text / javascript.

This method is used when defining a small block of code or when you want to include specific instructions in a specific HTML document that complete the instructions and functions that are included by default in all documents on the website.

The main drawback is that if you want to make a modification to the code block, it is necessary to modify all the pages that include that same block of JavaScript code.

Define JavaScript in an external file

JavaScript instructions can be included in an external JavaScript file that XHTML documents link using the <script> tag. You can create all the necessary JavaScript files and each XHTML document can link as many JavaScript files as you need.

In addition to the type attribute, this method requires defining the src attribute, which indicates the URL corresponding to the JavaScript file to be linked. Each <script> tag can only link a single file, but on the same page you can include as many <script> tags as necessary.

JavaScript files are normal text documents with the extension .js, which can be created with any text editor such as Notepad, Wordpad, EmEditor, UltraEdit, Vi, etc.

The main advantage of linking an external JavaScript file is that the XHTML code of the page is simplified, that the same JavaScript code can be reused on all pages of the website and that any modification made to the JavaScript file is immediately reflected in all the XHTML pages that link it.

Dettagli down

Generi Informatica e Web » Linguaggi e Applicazioni » Programmazione e sviluppo del software » Database

Editore Leonard Base

Formato Ebook con Adobe DRM

Pubblicato 18/07/2024

Lingua Inglese

EAN-13 1230008145369

0 recensioni dei lettori  media voto 0  su  5

Scrivi una recensione per "COMPUTER PROGRAMMING FOR BEGINNERS"

COMPUTER PROGRAMMING FOR BEGINNERS
 

Accedi o Registrati  per aggiungere una recensione

usa questo box per dare una valutazione all'articolo: leggi le linee guida
torna su Torna in cima