Forum Moderators: open

Message Too Old, No Replies

Formatting text in a layer for NS4.7

Any suggestions at all as I'm all out of ideas ...

         

Jeepers

3:53 pm on Jun 30, 2002 (gmt 0)

10+ Year Member



<totally lost>
I'm trying to format the font, colour, size, wieght and alignment of text written to a layer nested inside an ilayer inside a table cell in NS4.7. I have tried everthing I can think of, CSS, formatting the cell, inline style, nesting the whole lot inside a font tag. No matter what I do it displays in black, times new roman on the left.

The text is written to the layer by a function.

CSS works fine in IE6 & NS6, it's just NS4.7

Anybody any ideas at all.
</totally lost>

papabaer

4:10 pm on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Jeepers,
Welcome to Webmaster World!

NN4 just about demands that CSS be declared for every element/container combination you can think of... Have you tried applying the styles to the NN4 propriety ilayer?

Jeepers

5:26 pm on Jun 30, 2002 (gmt 0)

10+ Year Member



I have applied the style as a class from the style sheet and as a style within the ilayer and layer tags in about every combination I can think of. I have not found one thing that is affected by anything I do. However, all of the rest of the page uses the stylesheet perfectly. Annoying, very annoying.

Jeepers

7:53 pm on Jun 30, 2002 (gmt 0)

10+ Year Member



If anybody is interested this the relevant code

This is the function that writes to the layer


function displayIt(theStr,dname,Lname,iLname){
//if IE 4+
if (document.all)
document.all[dname].innerHTML=theStr;
//else if NS 4
else if (document.layers){
document[iLname].document[Lname].document.write(theStr);
document[iLname].document[Lname].document.close();
}
//else if NS 6 (supports new DOM)
else if (document.getElementById){
rng = document.createRange();
el = document.getElementById(dname);
rng.setStartBefore(el);
htmlFrag = rng.createContextualFragment(theStr);
while (el.hasChildNodes())
el.removeChild(el.lastChild);
el.appendChild(htmlFrag);
}
}

this is the cell in which the layer to be written to is in


<tr>
<td class="HLS" width="582" colspan="4" height="25" align="center">
<div id="d1" style="width:100%;height:25px"></div>
<ilayer id="iL1" width=100% height=25px><layer id="L1" width=100% height=25px></layer></ilayer>
</td>
</tr>

This is part of a much bigger page in which there are a further two cells of a similar nature

And its called by

displayIt('This is the string I want to write','d1','L1','iL1');

from another function.

tedster

8:21 pm on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Styling the text inside a table cell often requires redundant style declarations. A couple more ideas:

1. Declare the font style for td
2. Write the text using full <p></p> tags, then...
3. Declare the style using p#iL1 and p#L1 as selectors
4. Give the relevant <p> tag its own ID or class name

rewboss

6:25 am on Jul 1, 2002 (gmt 0)

10+ Year Member



I've found that NS4 is so bad at applying styles to nested elements, that once you get past a certain level you can do whatever you like with class and id attributes, it just won't work. In many cases I've resorted to style attributes (<td style="font-family: ....">), which rather defeats the object of CSS in the first place.

Another consideration is that the implementation of <ilayer> is not terribly brilliant either.