Posted by dorayme on 12/04/39 11:29
> From: Toby Inkster <usenet200510@tobyinkster.co.uk>
> dorayme wrote:
>
>> Seems that support is not great though... I think being
>> semantically correct gets to be too pricey if one has to make
>> gifs... My <p>* * *</p> (or at least with a div instead) is
>> still looking more tempting...
>
> OK. How about this:
>
> <script type="text/javascript">
> function hrReplace ()
> {
> var es = document.getElementsByTagName("HR");
> var agt = navigator.userAgent.toLowerCase();
> var is_opera = (agt.indexOf("opera") != -1);
> for (var i = 0; es[i]; i++)
> {
> if (is_opera)
> es[i].outerHTML = "<hr class=sep>";
> else
> es[i].outerHTML = "<p class=sep>* * *<\/p>";
> }
> }
> window.onload = hrReplace;
> </script>
>
> <style type="text/css">
> HR.sep {
> content: "* * *";
> text-align: center;
> color: red;
> background: transparent;
> border: 0px none;
> }
> P.sep {
> text-align: center;
> color: green;
> }
> </style>
>
> <p>Foo</p>
> <hr>
> <p>Bar</p>
>
> Works in IE and Opera. Anybody got an idea about how to work around
> Gecko's lack of support for outerHTML?
>
Yes, this works in my IE 5.1.6 and also in iCab but not in my
Mozilla 1.3.1 (WaMCom). Well done!
But er... just to recap, there is a sure fire simple bit of
markup (like the one I actually used at
http://dorayme.150m.com/opinionFolder/drugLaws.html). But it was
not kosher in its semanticity. You are addressing this, yes? At
the cost of some javascript (and clever too it seems to me!).
Now the question is, is the price worth it? How much do I want
to be semantically correct /and/ have asterisks? The best
solution stares me in the face, forget about asterisks and go
for <hr> with the simple styling widely workable (but I don't
mean to spoil any party here... :)
dorayme
[Back to original message]
|