Posted by Toby Inkster on 09/26/39 11:29
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?
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|