Click to See Complete Forum and Search --> : Mouseover link gives squares on page


florida
10-16-2003, 06:41 AM
I have a mouseover link script below that works in Netscape 4.77 and IE. It is suppose to go over the link and show a small box with text info about the link. It does work but after it goes over the link and shows the text info about link it makes ALL words on the Netscape 4.77 web page all look like weird squares. It works great in IE. Please advise where I can correct this problem. I also tried eliminating the fonts but it still gives squares on my Netscape 4.77 page. There are no frames on my page.


<html>
<head>
<title>Untitled</title>
</head>
<body>
<script language="JavaScript1.2" type="text/javascript">
if (!document.layers&&!document.all)
event="test"
function showtip(current,e,text,orientation) {
if (document.all) {
thetitle=text.split('<BR>')
if (thetitle.length > 1) {
thetitles=''
for (i=0;i<thetitle.length;i++)
thetitles+=thetitle[i]
current.title=thetitles
}
else {
current.title=text
}
} else if (document.layers) {
document.tooltip.document.write('<font>'+text+'</font>')
document.tooltip.document.close()
if (orientation == "right") {
document.tooltip.left=e.pageX+10
document.tooltip.top=e.pageY+10
} else {
document.tooltip.left=e.pageX-5
document.tooltip.top=e.pageY-5
}
document.tooltip.zIndex=1000
document.tooltip.visibility="show"
}
}
function hidetip() {
if (document.layers) {
document.tooltip.visibility="hidden"
}
}
if (top.frames.length!=0)
top.location=self.document.location;
</script>
<DIV ID="tooltip" STYLE="position:absolute;visibility:hidden;"></DIV>

<TABLE border="1" width="99%" align="center">

<tr>
<TD width="21%" ><A HREF="chec.cfm" TARGET="self"
onMouseOver="showtip(this,event,'ATL','right');return true"
onMouseOut="hidetip();"
TITLE="This event handler provides an popup message.">
ATL</A></TD>
<TD align="middle" width="7%" >test</TD>

</tr>
</table>


</body>
</html>

requestcode
10-16-2003, 07:45 AM
You might want to check out this Tool Tip script:
http://www.bosrup.com/web/overlib/

It works well with just about all browsers.

dragle
10-16-2003, 08:53 AM
NS4.x has a known problem with a certain character encoding, utf-8, such that the first dynamic write to a layer partially hoses the character encoding on the page, causing some or all regular text to appear as square boxes (as if they were unrecognized characters). I don't personally know of any other encodings that cause the problem in NS4.x, but I suppose there may be some. The only work around to the problem--short of redesigning to avoid writing to layers--is to declare a different encoding for the document, and that's assuming you can use a different encoding on your pages, of course.

Try explicitly setting the encoding to iso-8859-1 (or any other encoding) to see if the problem goes away. Even though you are not explicitly setting an encoding in your page now, NS4.x may be getting the utf-8 encoding from the HTTP header.

Cheers!

florida
10-16-2003, 09:26 AM
How do I explicitly set my encoding to encoding to iso-8859-1? I tried putting that in meta tags and it still doesnt work but dont know how to explicitly do it? Also what are other encodings I could try??

Thanks

dragle
10-16-2003, 10:01 AM
Hmmmmm... utf-8 is the only encoding I've personally seen that presents this problem; but I suppose you could have found some other similar problem. To set an encoding, you should just be able to use a meta content-type tag in the head; i.e.,

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

You might also send a link to your page where it actually lives; we might be able to tell more from that. I just tried your page as is locally in NS4.8 and it worked fine; it also worked fine with the meta tag above. Setting the tag above to utf-8 triggered the problem, though.

Cheers!

P.S. - If you're using ASP.NET the default character encoding is utf-8. See this page in msdn for further info:

MSKB: Square Boxes in NS4/ASP.NET (http://support.microsoft.com/default.aspx?scid=kb;en-us;309548)

florida
10-16-2003, 12:50 PM
Thanks, I tried the meta tag part and it still doesnt work.