...

View Full Version : Weird characters on mouseover



florida
10-15-2003, 09:28 PM
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 think I know where the problem is but can figure out how to fix it?



<DIV ID="tooltip" STYLE="position:absolute;visibility:hidden;"></DIV>
<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) { //HERE AND BELOW IS WHERE THE PROBLEM SEEMS TO BE IN NETSCAPE
document.tooltip.document.write('<strong>'+text+'</strong>')
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>

florida
10-15-2003, 09:41 PM
I forgot to say I dont have any frames in this page and it is an HTML page.

Roy Sinclair
10-15-2003, 10:09 PM
Squares in place of characters usually indicates a problem with the font family not supporting the particular characters being used. Try changing the specification for the font family.

florida
10-16-2003, 12:32 PM
I got rid of all fonts and it still does it. Anymore advise?

thanks

glenngv
10-16-2003, 01:40 PM
What exactly is the value of the text parameter passed to the showtip() function?

florida
10-16-2003, 02:42 PM
Here is how it is called in my mouseover and mouseout:




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

<tr>
<TD width="21%" ><A HREF="chec.cfm" TARGET="self" onMouseOver="showtip(this,event,'VALUE OF TEXT','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>

Roy Sinclair
10-16-2003, 06:54 PM
It works fine (no strange block characters) in Netscape 4.75 (which is what I use for testing NS 4).

Here's the whole sample page I put it in (where it worked). Try it with your system, so we can narrow this down a bit:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Testing</title>
<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) { //HERE AND BELOW IS WHERE THE PROBLEM SEEMS TO BE IN NETSCAPE
document.tooltip.document.write('<strong>'+text+'</strong>')
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>
</head>
<body>
<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,'VALUE OF TEXT','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>

glenngv
10-17-2003, 01:58 AM
Originally posted by florida
Here is how it is called in my mouseover and mouseout:




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

<tr>
<TD width="21%" ><A HREF="chec.cfm" TARGET="self" onMouseOver="showtip(this,event,'VALUE OF TEXT','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>

Is that the actual text passed? That should definitely work, as Roy tested.

florida
10-17-2003, 02:13 PM
Thanks and I see if works as an HTML page but unfortunately this is a Cold Fusion page and it gives the weird characters on my Cold Fusion MX web page. I tried changing the content="text/cfm; charset=iso-8859-1 but it still gives weird characters in my Netscape 4.77 browser. Any suggestions on what else I could try??

Thanks again!

Roy Sinclair
10-17-2003, 03:07 PM
Shouldn't you be outputting "text/htm" to the browser? If shouldn't know anything about "text/cfm".

florida
10-17-2003, 03:53 PM
Actually I just tested "text/html" and I tested "text/htm" and what I posted was just another attempt to get it to work in cfm so I tested "text/cfm". All still gave me the weird characters in my Cold Fusion MX page in Netscape 4.77. Any other suggestions??

Roy Sinclair
10-17-2003, 04:09 PM
Try doing a view-source on the output web page and then cut and past that into a text file. See if the problem still exists in the text file copy.

florida
10-20-2003, 12:30 PM
I copied source and put it in text file and then copied it back to server and it still shows weird characters. Any other suggestions??

Roy Sinclair
10-20-2003, 03:52 PM
Since you can reproduce it using a static web page instead of always involving Cold Fusion then it's time to look at the static code it's generating.

Try simply deleting various parts of the static web page to see whether you can narrow the problem down to a small part of the page. If it's not too proprietary (or too large) you could even post the static html here so more people could look at it and help in finding the offending code.

florida
10-20-2003, 04:41 PM
Roy,

Thanks for all your help on this. I still got weird characters using the JavaScript you had in an earlier reply (see below JavaScript). I will just have to keep working at it. Again thanks for all your time and help!!



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Testing</title>
<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) { //HERE AND BELOW IS WHERE THE PROBLEM SEEMS TO BE IN NETSCAPE
document.tooltip.document.write('<strong>'+text+'</strong>')
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>
</head>
<body>
<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,'VALUE OF TEXT','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>

Roy Sinclair
10-20-2003, 05:18 PM
You might want to try reinstalling Netscape, it may just be a fouled up installation.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum