Thursday, November 1, 2012

content

Properti HTMLMetaElement.content menetapkan atau mengembalikan atribut CONTENT elemen META HTML.

Sintaks:

metaObj.content = value metaObj.content

Contoh di bawah ini mengembalikan nilai atribut CONTENT:

<META NAME="keywords" CONTENT="HTML, CSS, JavaScript, DHTML"> <SCRIPT TYPE="text/javascript"> var metaObj = document.getElementsByTagName("meta")[0]; alert(metaObj.content); // "HTML, CSS, JavaScript, DHTML" </SCRIPT>

Contoh di bawah ini menetapkan atribut CONTENT:

<META NAME="keywords"> <SCRIPT TYPE="text/javascript"> var metaObj = document.getElementsByTagName("meta")[0]; metaObj.content = "HTML, CSS, JavaScript, DHTML"; </SCRIPT>

Elemen META di atas akan menjadi:

<META NAME="keywords" CONTENT="HTML, CSS, JavaScript, DHTML">