Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a number of methods that let you select elements without knowing the id, e.g.:</p> <ul> <li><a href="https://developer.mozilla.org/en/DOM/Document.querySelectorAll" rel="nofollow"><code>.querySelectorAll()</code></a></li> <li><a href="https://developer.mozilla.org/en/DOM/document.getElementsByTagName" rel="nofollow"><code>.getElementsByTagName()</code></a></li> <li><a href="https://developer.mozilla.org/en/DOM/document.getElementsByClassName" rel="nofollow"><code>.getElementsByClassName()</code></a></li> </ul> <p>UPDATE: I don't see any way to distinguish between two <code>&lt;br&gt;</code> elements in a row that are an end-of-entry marker and two <code>&lt;br&gt;</code> elements in a row that are simply part of a particular entry. From your examples, the "text" entries can contain anything that might have been in the name/location/date line. So simplifying it slightly and taking <em>every</em> double-br as an end of entry you can do something like this:</p> <pre><code>window.onload = function() { var fontTags = document.getElementsByTagName("font"), i, j = 0; for (i = 0; i &lt; fontTags.length; i++) fontTags[i].innerHTML = '&lt;div class="entry odd"&gt;' + fontTags[i].innerHTML.replace(/&lt;br&gt;\s*?&lt;br&gt;/g, function() { return '&lt;/div&gt;&lt;div class="entry ' + (j++ %2===0?'even':'odd') + '"&gt;'; }) + '&lt;/div&gt;'; }; </code></pre> <p>This assumes all font elements contain data to be processed and uses <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace" rel="nofollow"><code>.replace()</code></a> to find the double-br occurrences and put wrapper divs around each entry instead. I've given every div a class "entry", and then alternate ones the classes "even" and "odd" so that you can then apply a style like this:</p> <pre><code>div.odd { color : red; } </code></pre> <p>As shown in this demo: <a href="http://jsfiddle.net/C4h7s/" rel="nofollow">http://jsfiddle.net/C4h7s/</a></p> <p>Obviously you could use inline styles to set the colours if you can't add classes to the stylesheet.</p> <p>That's the closest I could get to your every-other-entry-is-red requirement. I'm not actually using the "entry" class for anything in that example, but at the time it seemed like it might be useful later, e.g., in this really clunky implementation of the click to toggle idea: <a href="http://jsfiddle.net/C4h7s/1/" rel="nofollow">http://jsfiddle.net/C4h7s/1/</a></p> <p>(I don't really have time or motivation to tidy those demos up, but at least they should give you some ideas of one way to proceed. Or one way <em>not</em> to proceed, depending on how silly you think my code is.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload