HTML DOM link href atributo
Definição e Uso
atributo href é um legível e gravável conjuntos de cordas ou retorna a URL completa do documento exibido atualmente.
gramática
Defina o atributo href:
linkObject.href="URL"
Voltar atributo href:
linkObject.href
Suporte a navegadores
Todos os principais navegadores suportam atributo href
Exemplos
Exemplos
Clique em um botão para ligar folhas de estilo:
<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Link id = "style1" rel = tipo de "estilo" = "text / css" href = "style1.css">
<Script>
displayResult function () {
document.getElementById ( "style1") href = "style2.css" .;
}
</ Script>
</ Head>
<Body>
<H1> My Home Page </ h1>
<Button type = "button" onclick = "displayResult ()"> para mudar as folhas de estilo </ button>
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Link id = "style1" rel = tipo de "estilo" = "text / css" href = "style1.css">
<Script>
displayResult function () {
document.getElementById ( "style1") href = "style2.css" .;
}
</ Script>
</ Head>
<Body>
<H1> My Home Page </ h1>
<Button type = "button" onclick = "displayResult ()"> para mudar as folhas de estilo </ button>
</ Body>
</ Html>
tente »
vincular objetos