Output
My name is Elizabeth.
Sample Code
Microdata allows machine-readable data to be embedded in HTML documents in an easy-to-write manner, with an unambiguous parsing model.
At a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property.
Items and properties are represented by regular elements.
<p>My name is <span id="microdataProperty" itemprop="name">Elizabeth</span>.</p></div>
<script>
function output() {
if (!!document.getItems) {
var T = document.getItems()[0];
alert(T);
alert(T.properties);
alert(T.properties.name[0]. itemValue);
}
return false;
}
</script>
<form>
<input type="button" value="Click" onClick="output()" />
</form>
At a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property.
Items and properties are represented by regular elements.
HTML:
<div id="microdataItem" itemscope><p>My name is <span id="microdataProperty" itemprop="name">Elizabeth</span>.</p></div>
<script>
function output() {
if (!!document.getItems) {
var T = document.getItems()[0];
alert(T);
alert(T.properties);
alert(T.properties.name[0]. itemValue);
}
return false;
}
</script>
<form>
<input type="button" value="Click" onClick="output()" />
</form>