1 / 10

JavaScript

JavaScript. DOM – Document Object Model. DOM - Document Object Model. API implementata dai browser Indipendente dal linguaggio e dalla piattaforma Forma di rappresentazione dei documenti strutturati Definisce il modo di accedere alla struttura del documento

betha
Download Presentation

JavaScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JavaScript DOM – DocumentObjectModel

  2. DOM - DocumentObjectModel • API implementata dai browser • Indipendente dal linguaggio e dalla piattaforma • Forma di rappresentazione dei documenti strutturati • Definisce il modo di accedere alla struttura del documento • Permette di visualizzare un documento sotto forma di albero • Gli elementi del documento sono i nodi dell’albero • Standard ufficiale del W3C http://www.w3.org/DOM/ Alice Pavarani

  3. DOM di un documento HTML • Il browser interpretando un documento HTML ne genera il DOM • Esempio: DOCUMENT HTML HEAD BODY TITLE META H1 H2 P A Testo del paragrafo Esempio DOM Titolo Sottotitolo Link Alice Pavarani

  4. DOM e JavaScript: gli oggetti ospite • Il DOM non è una parte di JavaScript • Il DOM è una collezione di oggetti per Javascript window navigator plugin mimeType frame document location history layer link area form anchor applet plugin image text password submit reset button textarea fileUpload hidden radio checkbox select option Alice Pavarani

  5. Proprietà e metodi comuni Alice Pavarani

  6. Windowproprietàhttp://www.w3schools.com/jsref/obj_window.aspWindowproprietàhttp://www.w3schools.com/jsref/obj_window.asp • Il padre di tutti gli oggetti • Rappresenta la finestra corrente del browser Alice Pavarani

  7. Windowmetodihttp://www.w3schools.com/jsref/obj_window.asp • Il padre di tutti gli oggetti • Rappresenta la finestra corrente del browser Alice Pavarani

  8. Documenthttp://www.w3schools.com/jsref/dom_obj_document.asp • Rappresenta il documento HTML Alice Pavarani

  9. Locationhttp://www.w3schools.com/jsref/obj_location.asp • Contiene le informazioni riguardo l’indirizzo URL corrente • History • http://www.w3schools.com/jsref/obj_history.asp • Contiene gli indirizzi URL visitati all’interno della finestra corrente Alice Pavarani

  10. Navigatorhttp://www.w3schools.com/jsref/obj_navigator.asp • Rappresenta il browser che visualizza la pagina Web • Fornisce informazioni sul browser Esempio tratto da http://www.w3schools.com/js/js_window_navigator.asp <script> // oggetto Navigator - Informazioni sul Browser txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>"; txt += "<p>Browser Name: " + navigator.appName + "</p>"; txt += "<p>Browser Version: " + navigator.appVersion + "</p>"; txt += "<p>CookiesEnabled: " + navigator.cookieEnabled + "</p>"; txt += "<p>Browser Language: " + navigator.language + "</p>"; txt += "<p>Browser Online: " + navigator.onLine + "</p>"; txt += "<p>Platform: " + navigator.platform + "</p>"; txt += "<p>User-agentheader: " + navigator.userAgent + "</p>"; txt += "<p>User-agentlanguage: " + navigator.systemLanguage + "</p>"; document.writeln(txt); </script> Alice Pavarani

More Related