US anti-terror military death count JavaScript for your site

Monday, 24 September 2007

Three numbers are available with customizable display options. E.g.–

Which adds up to –

Put this in your page

<script type="text/javascript"

Get this

Only want the number?

<p style="text-align:center">
<script type="text/javascript"

Get this

And that, as they say, is that.

The data comes from The default display is the sum of their Iraq and Afghanistan numbers. You can set it to return just one or the other. The numbers link back to them, as they should. Those folks work hard on their site and getting it right. Here is their donations page; they broke it and don’t have one you can link directly anymore so…

The numbers displayed by the JavaScript are updated from them often. No guarantees but unless you are checking all day, our version is much more likely to reflect the current values at iCasualties than what you saw the last time you looked.

API, CSS, and placement

The (X)HTML it generates looks something like this (whitespace added)–

<span id="USmilBodyCount">
US military deaths in war on terror:
<b><a title="Iraq + Afghanistan casualties"

Text in a span with an id (in bold above) you can hook with your own style sheet if you choose. The generated (X)HTML is appended to the nodes of whatever parent it sits in. That means it might jump down somewhere you don’t expect or want. If that happens, just wrap it in <p>[script here]</p> to anchor it as a child, the only one, of that paragraph tag.

Content served as application/xhtml+xml will not be placed correctly. The script self-identification technique used only works if the script can see the DOM as it is loaded; streamlike. In application/xhtml+xml, as other XML, the DOM is only available, atomically, after it has all been loaded.

Allowed arguments in src querystring

no, the number of fatalities for which country
no=full, the default, shows both combined
no=a, for Afghanistan’s number only
no=i, for Iraq’s number only
text=on, the default
text=off, to only show the number
sep, the separator of the text and number; using it implies you want the text on
sep=:, the default, for a colon
sep=n, for an en-dash with whitespace
sep=m, for an em-dash without whitespace
sep=br, for an (X)HTML line break, <br/>

Two more examples

<script type="text/javascript"

<p style="text-align:center">
<script type="text/javascript"


There is no branding (Sedition·com) on it right now. If you want it to stay that way, make sure to mention us if you use it.

Now for some SEO missing above

US military fatalities, troops killed.

digg stumbleupon reddit Fark Technorati Faves
Your information (required) Name*

* Indicates required fields; email is used for validation and is not displayed on the site.

Your comment
Commenting on US anti-terror military death count JavaScript for your site

Body is limited to ≈1,000 words. Paragraphs—but not line breaks—are automatically inserted. Valid XHTML is required. These are the allowed tags–

<a href=""></a> <br/> <acronym title=""></acronym> <abbr title=""></abbr> <code></code> <pre></pre> <tt></tt> <ins></ins> <del></del> <hr/> <cite></cite> <b></b> <i></i> <sup></sup> <sub></sub> <strong></strong> <em></em> <h1></h1> <h2></h2> <h3></h3> <q></q> <blockquote></blockquote>