HTML DOM Meta properti konten
Definisi dan Penggunaan
konten set properti atau mengembalikan konten meta nilai atribut.
Atribut konten menentukan informasi meta konten.
Catatan: Properti ini tersedia tergantung pada nilai nama dan httpEquiv properti.
tatabahasa
Pengaturan properti konten:
linkObject.content="text"
Pengembalian properti konten:
linkObject.content
Dukungan Browser
Semua browser utama mendukung properti konten
contoh
contoh
Tampilkan semua nilai atribut konten meta:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Meta name = "keywords" content = "HTML, DHTML, CSS, XHTML, JavaScript">
<Meta name = "description" content = "Free Web tutorial">
<Meta name = "author" content = "Hege Refsnes">
<Meta http-equiv = "Content-Type" content = "text / html; charset = utf-8">
<Script>
Fungsi displayResult () {
var x = document.getElementsByTagName ( "meta");
var txt = "";
for (var i = 0; i <x.length; i ++) {
txt = txt + "Isi" + (i + 1) +: + x [i] .content + "Situs"; "meta tag."
}
document.getElementById ( "hasil") innerHTML = txt .;
}
</ Script>
</ Kepala>
<Body>
<Tombol type = "button" onclick = "displayResult ()"> Tampilan konten Meta </ button>
<P id = "hasil"> </ p>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Meta name = "keywords" content = "HTML, DHTML, CSS, XHTML, JavaScript">
<Meta name = "description" content = "Free Web tutorial">
<Meta name = "author" content = "Hege Refsnes">
<Meta http-equiv = "Content-Type" content = "text / html; charset = utf-8">
<Script>
Fungsi displayResult () {
var x = document.getElementsByTagName ( "meta");
var txt = "";
for (var i = 0; i <x.length; i ++) {
txt = txt + "Isi" + (i + 1) +: + x [i] .content + "Situs"; "meta tag."
}
document.getElementById ( "hasil") innerHTML = txt .;
}
</ Script>
</ Kepala>
<Body>
<Tombol type = "button" onclick = "displayResult ()"> Tampilan konten Meta </ button>
<P id = "hasil"> </ p>
</ Body>
</ Html>
Coba »
meta Object