Attributo tipo Anchor

Definizione e uso

type L'attributo imposta o restituisce il tipo del link Attributo type del valore.

type L'attributo specifica il tipo MIME del documento collegato.

Suggerimento:type L'attributo è puramente suggestivo.

Nota:Attributo type È una nuova proprietà dell'elemento <a> in HTML5.

Esempio

Esempio 1

Restituisce il tipo MIME del link specifico:

var x = document.getElementById("myAnchor").type;

Prova personalmente

Esempio 2

Imposta l'attributo type del link su text/html:

document.getElementById("myAnchor").type = "text/html";

Prova personalmente

Sintassi

Restituisce l'attributo type:

anchorObject.type

Imposta l'attributo type:

anchorObject.type = MIME-type

Valore dell'attributo

Valore Descrizione
MIME-type

Definisce il tipo MIME del documento collegato.

Vedere Tipi MIME IANA, per ottenere l'elenco completo dei tipi MIME standard.

Dettagli tecnici

Valore di ritorno: Valore di stringa che rappresenta il tipo MIME del documento collegato.

Supporto dei browser

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supporto Supporto Supporto Supporto Supporto

Pagine correlate

Manuale di riferimento HTML:Proprietà type dell'elemento <a> HTML