HTML and CSS Reference
In-Depth Information
This is what the event markup looks like:
<div itemscope
itemtype="http://microformats.org/profile/hcalendar#vevent">
<h2 itemprop="summary">The Big Date</h2>
<p>
<time itemprop="dtstart" datetime="2011-08-31T20:00:00Z">
31st August @ 8pm
</time>
until
<time itemprop="dtend" datetime="2011-08-31T22:00:00Z">
10pm
</time>
(or all night, if things go well)
</p>
<p>Location:
<span itemprop="location">Macmillan Observatory</span>
</p>
</div>
Keeping the same function as before, all three microdata items are
found and their properties enumerated. But maybe you're writing a
calendar-event application and are only interested in the events; or,
slightly more creepily, you might be writing context-sensitive advertis-
ing into the page with JavaScript and keen to pull out locations and
dates. Rather than grab all the items and discard the ones you're not
interested in, you can tell the getItems() method which sort of items
you want:
document.getItems('http://microformats.org/profile/hcalendar#vevent');
The parameter is a space-separated list, so you can specify more than
one type if necessary—for example, if you want to look for items of
The microdata API lets you access structured data within your page
content. This is useful when you're not in control of the
generation of the content and need to generate an alternative view
or index of the data, or give the user the option of clicking a link
to a contact in their address book or an event in their calendar.
Search WWH ::




Custom Search