...

View Full Version : Strange explorer bug that hangs javascript



jbrnra
02-03-2005, 11:14 AM
Hi all,

I found a strange explorer bug (I'm using version 6) that if it finds a plus sign with some text imediately after it, on some machines it present it as some japanese characters and keep looping javascript loops forever.

For example:



<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
//+-+-+-+-+-+-+-+-+-+-+-+-+for highlight row+-+-+-+-+-+-+-+-+-+-+-+-+//
function test(){
for (i=0;i<3;i++) {
alert(i);
}
}
</SCRIPT>
</head>

<body>
This is a mystery:
+jkshdfjsdh
<br>
<table>
<tr onclick="test();">
<td>
<b>click here...</b>
</td>
</tr>
</table>
</body>
</html>


produces a garbeled display with some japanese characters, and it does not increment the i variable in the loop so it loops forever!

It also happen in a middle of a javascript comment stating with //

If I put just a space after the '+' then it works fine.

Anybody has a clue?

jbot
02-03-2005, 12:06 PM
I found a strange explorer bug (I'm using version 6) that if it finds a plus sign with some text imediately after it, on some machines it present it as some japanese characters and keep looping javascript loops forever.

Anybody has a clue?


didn't do it for me!

Kor
02-03-2005, 12:52 PM
The mistery lays in the absence of the doctype and the necessary meta tags.

if you have had correctly coded, there would have not been any mistery at all:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script language="JavaScript" type="text/JavaScript">
function test(){
for (var i=0;i<3;i++) {
alert(i);
}
}
</script>
</head>
<body>
This is a mystery:
+jkshdfjsdh
<br>
<table>
<tr onclick="test();">
<td>
<b>click here...</b>
</td>
</tr>
</table>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum