<JavaScript String Riferimento
Esempio
Visualizzare il testo: "Free Web Building Tutorials!" come un collegamento ipertestuale:
var str = "Free Web Building Tutorials!";
var result = str.link("http://www.w3ii.com");
Prova tu stesso " Più "Try it Yourself" esempi di seguito.
Definizione e l'utilizzo
Il link() metodo non è standard, e potrebbe non funzionare come previsto in tutti i browser.
Il link() metodo viene utilizzato per visualizzare una stringa come un collegamento.
Questo metodo restituisce la stringa incorporato nel <a> tag, in questo modo:
<a stringa href="URL"> </a>
Supporto browser
Metodo | |||||
---|---|---|---|---|---|
link() | sì | sì | sì | sì | sì |
Sintassi
valori dei parametri Parametro Descrizione url Necessario. L'URL per collegarsi a
Dettagli tecnici
Valore di ritorno: Una stringa incorporato nel <a> tag Versione JavaScript: 1.0

Altri esempi
Esempio
Una dimostrazione di metodi correlati:
var txt = "Hello World!";
document.write("The original string: " +
txt);
document.write("<p>Big: " + txt.big() + "</p>");
document.write("<p>Small:
" + txt.small() + "</p>");
document.write("<p>Bold: " + txt.bold() +
"</p>");
document.write("<p>Italic: " + txt.italics() + "</p>");
document.write("<p>Fixed: " + txt.fixed() + "</p>");
document.write("<p>Strike:
" + txt.strike() + "</p>");
document.write("<p>Fontcolor: " +
txt.fontcolor("green") + "</p>");
document.write("<p>Fontsize: " +
txt.fontsize(6) + "</p>");
document.write("<p>Subscript: " + txt.sub() +
"</p>");
document.write("<p>Superscript: " + txt.sup() + "</p>");
document.write("<p>Link: " + txt.link("http://www.w3ii.com") + "</p>");
document.write("<p>Blink: " + txt.blink() + " (works only in Opera)</p>");
Prova tu stesso "
<JavaScript String Riferimento