"Lars Forslin" <la***********************@home.se> writes:
I am configurating this guestbook that shows text way too big. I have tried
with style sheets and font tags, but they are ignored (not the font, but the
size).
Probably because the code contains something like <font size="+7">.
If that is the case, drop the crap. It's either ancient or written
by somebody not familiar with modern web design.
Alternatively, it might contain elements with an attribute
style="font-size:huge"
or something.
I figure a javascript could do it, but I haven't found an applicable
script anywhere. I do think it would be rather straightforward though. I
want the text to be set to x-small (or a relative zoom level) immediately on
load. Anyone that has a script ready?
Guesses, if it is font tags::
1) find font tags. Remvove the size attribute:
<script type="text/javascript">
function removeFont(){
var fonts = document.getElementsByTagName("font");
for (var i=0;i<fonts.length;i++) {
var font = fonts[i];
font.size = "";
font.setAttribute("size","");
}
}
</script>
2) find and remove font tags using DOM:
<script type="text/javascript">
function removeFont(){
var fonts = document.getElementsByTagName("font");
for (var i=0;i<fonts.length;i++) {
var font = fonts[i];
var next = font.nextSibling;
var parent = font.parentNode;
while(font.hasChildNodes) {
var last = font.lastChild;
parent.insertBefore(last,next);
next = last;
}
}
}
</script>
Code not tested (no pages with <font> available).
Run it from the onload handler.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'