You are here: Re: styled text substitute for a picture that fails to load... « HTML « IT news, forums, messages
Re: styled text substitute for a picture that fails to load...

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация