Link to home
Start Free TrialLog in
Avatar of spunog
spunog

asked on

Layer messes up other text on screen

Greetings,
I have a layer which I use to display some text. When the layer is changed to visibility = 'show' then if I move another window in front of netscape all the other text on the page gets changed to : [][][][][] . The text in the Layer is not affected . I am using NS4.75 . Whats the Spiel with this ?
Cheersw
Spunog
Avatar of Ecks
Ecks

That's crazy man!  Just plain weird.

Um... hm... erm...

What the browser's encoding set to (language)?  Are you putting different text encodings into the layer then what is in the main document?

Avatar of spunog

ASKER

The encoding is set as follows:
<%@ page errorPage="SimpleErrorPage.jsp"
contentType="text/html; charset=UTF-8"session="true"
buffer="1kb"%>
The layer is very simple :
<LAYER id="errorMessage" align="left" style="width:600px; position:relative; visibility: hidden "> </LAYER>

Then I write html to the layer from javascript as follows :

document.errorMessage.document.open();    
               document.errorMessage.document.write("<table border='0' cellspacing='0' cellpadding='0' width='585' summary='This table is used for layout only.'><tr><td><br></td></tr><tr><td><font color='#FF0000'><getString:getString stringId="duplicationerror"/></font></td></tr></table>");
               document.errorMessage.document.close();                    
               document.errorMessage.visibility = 'show';
Avatar of spunog

ASKER

The encoding is set as follows:
<%@ page errorPage="SimpleErrorPage.jsp"
contentType="text/html; charset=UTF-8"session="true"
buffer="1kb"%>
The layer is very simple :
<LAYER id="errorMessage" align="left" style="width:600px; position:relative; visibility: hidden "> </LAYER>

Then I write html to the layer from javascript as follows :

document.errorMessage.document.open();    
               document.errorMessage.document.write("<table border='0' cellspacing='0' cellpadding='0' width='585' summary='This table is used for layout only.'><tr><td><br></td></tr><tr><td><font color='#FF0000'><getString:getString stringId="duplicationerror"/></font></td></tr></table>");
               document.errorMessage.document.close();                    
               document.errorMessage.visibility = 'show';
ASKER CERTIFIED SOLUTION
Avatar of Ecks
Ecks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of spunog

ASKER

Removing it altogether doesn't fix it. Ho do I set the layer to use a specific encoding ?
Thanks
Spunog
Avatar of spunog

ASKER

Removing it altogether doesn't fix it. Ho do I set the layer to use a specific encoding ?
Thanks
Spunog
You can place header information into a layer, although I will have to double check to see if there is a more "proper" way.

Is this whole page being generated by a scripting language, or just your header information?  Try placing everything in a flat .html, with no code other then JavaScript, and see what happens.

Does that layer and/or main document contain any Unicode characters?
Avatar of spunog

ASKER

Is a layer treated as a totaly separate html source , therefore the meta tags on the page are not available to the layer ? sound crazy ?
Avatar of spunog

ASKER

The ISO-8859-1  works fine but unfortunately it must be UTF-8 . So I need to know how to set the charset of a layer.
try:

<SCRIPT LANGUAGE='JavaScript'>
theObj = getElementById('layername');
theObj.setAttribute('encoding', 'UTF-8');
</SCRIPT>

... this is assuming your using Gecko (Mozilla or Navigator 6+).  I am not sure if IE actually supports the standardized DOM yet.

I'm not sure if "encoding" is the right either.  Try "charset" too if it doesn work.  I'll have to do some more digging to figure out if an Element even has the appropriate attribute.

Avatar of spunog

ASKER

So should that be put within the layer tags ??
No.

Try it at the bottom of your document, to make sure everything has loaded.
Avatar of spunog

ASKER

This actually worked but not for me in the way I needed. The problem was that Netscape does not like document.write to a layer or whatever so I made a bunch of em with all possible text and basically just hide em or make em appear when appropriate. Thanks a lot buddy you have been very helpfull.....
Spunog