2011-03-07 38 views
1

如何在Mozilla Firefox的正文部分找到元標記?使用JavaScript在Mozilla Firefox中查找元標記

例子:

<!DOCTYPE html> 
    <head profile="http://microformats.org/profile/hcalendar"></head> 
    <body> 
    <div itemscope itemtype="http://data-vocabulary.org/Event"> 
     <a href="http://www.example.com/events/spinaltap" itemprop="url" ><span itemprop="summary">Spinal Tap</span></a> 
     <img itemprop="photo" src="spinal_tap.jpg" /> 
     <span itemprop="description">After their highly-publicized search for a new drummer,Spinal Tap kicks off their latest comeback tour with a SanFrancisco show.</span> 
     When: 
     <time itemprop="startDate" datetime="2015-10-15T19:00-08:00">Oct 15, 7:00PM</time>— 
     <time itemprop="endDate" datetime="2015-10-15T19:00-08:00">Oct 15, 9:00PM</time> 
     Where: 
     <span itemprop="location" itemscope itemtype="http://data-vocabulary.org/?Organization"> 
      <span itemprop="name">Warfield Theatre</span> 
      <span itemprop="address" itemscope itemtype="http://data-vocabulary.org/Address"> 
       <span itemprop="street-address">982 Market St</span>, 
       <span itemprop="locality">San Francisco</span>, 
       <span itemprop="region">CA</span> 
      </span> 
      <span itemprop="geo" itemscope itemtype="http://data-vocabulary.org/?Geo"> 
       <meta itemprop="latitude" content="35.774929"/> 
       <meta itemprop="longitude" content="-122.419416"/> 
      </span> 
     </span> 
     Category: <span itemprop="eventType">Concert</span> 
    </div> 
    </body> 
</html> 

這似乎是Firefox是meta標籤移動到頭部使其無法到達的itemprop =「地理」的子元素。有沒有比通過標籤名獲取lat/lng元標籤更好的方法,然後將它們與itemtype =「Event」一起拼圖?

+0

爲什麼在你的文檔的擺在首位中間meta標籤? – Neil 2011-03-09 00:28:13

+0

在HTML5中,您可以在任何地方使用元素。在這個例子中它註釋了不可見的數據。 – johansalllarsson 2011-03-12 22:11:08

+0

在這種情況下,您的文檔只能在HTML5瀏覽器中運行,所以您必須等待Firefox 4。 – Neil 2011-03-12 23:31:59

回答

相關問題